Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: .d.ts type issue and resulting type errors #1249

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

jorenbroekema
Copy link
Collaborator

@jorenbroekema jorenbroekema commented Jun 19, 2024

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:

  • changeset for typeDelegateDtcg util which removes the group level $type
  • update docs about this

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jorenbroekema jorenbroekema requested a review from a team as a code owner June 19, 2024 12:34
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1249.d16eby4ekpss5y.amplifyapp.com

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1249.d1ouz7xofr5p4l.amplifyapp.com

@jorenbroekema jorenbroekema merged commit cb78c3d into v4 Jun 28, 2024
4 checks passed
@jorenbroekema jorenbroekema deleted the type-fixes branch June 28, 2024 09:03
jorenbroekema added a commit that referenced this pull request Jun 28, 2024
* fix: .d.ts type issue and resulting type errors

* chore: switch to using TS files for local reusable type interfaces

* fix: remove  on token group level
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant