fix: .d.ts type issue and resulting type errors #1249
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
microsoft/TypeScript#30511
local
.d.ts
files are skipped when using skipLibCheck, waiting for TypeScript to allow configuring this a bit better to check local "lib".d.ts
files.Right now you can temporarily disable skipLibCheck in tsconfig, run lint:types script and filter for the errors coming from our own .d.ts. Fixing the type issue there resulted in a bunch of other type errors, which this PR fixes by introducing a PreprocessedTokens interface where $type property on group level won't exist anymore. This then makes it easier to use in the code when on token group level we know for sure that every prop is either also a token group or a token (both objects).
The PR also comes with a minor fix to remove the group level $type right before user-defined preprocessors, since the $type is delegated to the token level for all tokens.
If needed, users can use
convertToDTCG
utility to delegate the$type
from the token level to its farthest common ancestor again, e.g. in format lifecycle.TODO:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.