typesPresence
Enforces that the
typesproperty is present.
✅ This rule is included in the package-json preset.
This rule requires the types field in package.json to be present.
Examples
Section titled “Examples”{}{ "name": "my-repository"}{ "types": "./index.d.ts"}{ "name": "my-repository", "types": "./index.d.ts"}Options
Section titled “Options”ignorePrivate
Section titled “ignorePrivate”Whether the property should still be required when the package’s private property is true.
Defaults to false.
This option can be useful if the rule is enabled on many package.json files and some files differ in privacy.
When Not To Use It
Section titled “When Not To Use It”If your package generates .d.t.s files only in locations TypeScript will automatically detect, or does not publish TypeScript declarations, you can disable this rule.
Most projects generally don’t need this rule because sibling declarations are inferred from the file structure.
Alternately, a non-public JavaScript-only package without declaration files may not need a types field or types at all.
Related Rules
Section titled “Related Rules”- mainPresence - Enforces that the
mainproperty is present. - modulePresence - Enforces that the
moduleproperty is present.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
package-json/require-types
Made with ❤️🔥 around the world by
the Flint team and contributors.