eslint / rewrite

Monorepo for the new version of ESLint
Apache License 2.0
169 stars 11 forks source link

fix: non-optional properties in generic interfaces #132

Closed fasttime closed 3 weeks ago

fasttime commented 4 weeks ago

Prerequisites checklist

What is the purpose of this pull request?

Fix a bug in the types.

What changes did you make? (Give an overview)

This PR fixes the type integration tests in ESLint which would currently fail with @eslint/core@0.8.0 (eslint/eslint#19098).

The fix consists in marking the properties of generic interfaces as non-optional, meaning that they can't be undefined. These properties are only used to refer to a type. For example there is no actual object with a property MessageIds, but RuleDefinitionTypeOptions["MessageIds"] is used as an alias for string. If a union with undefined is desired, it can always be indicated explicitly as RuleDefinitionTypeOptions["MessageIds"] | undefined.

Related Issues

refs eslint/eslint#19098

Is there anything you'd like reviewers to focus on?