Repository navigation
fix(types): use type-only imports for strict TypeScript consumers - #771
Merged
Merged
Conversation
React Native consumers resolve the published TSX source through the react-native export condition. Mark the four type imports explicitly so verbatimModuleSyntax consumers can type-check that source without errors. Include a patch changeset and preserve the generated JavaScript. Constraint: Consumers can resolve src/index.tsx instead of declaration files Confidence: high Scope-risk: narrow Tested: Consumer TypeScript 6.0.3 with react-native condition and verbatimModuleSyntax; ESLint; Prettier; identical Babel JavaScript output Not-tested: Full Jest suite and native builds; locked dependency download returned npm 404
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix TS1484 errors for React Native consumers using
verbatimModuleSyntax: true.With the
react-nativeexport condition enabled, TypeScript resolves this package tosrc/index.tsxand checks the source directly. Four types are currently imported as values, causing consumer type checks to fail.ReactNode,StyleProp,ViewStyle, andLayoutChangeEventas type-only imports.Verification
Using existing consumer dependencies (TypeScript 6.0.3 and React Native 0.88.1):
customConditions: ["react-native"]andverbatimModuleSyntax: true.git diff --checkpassed.Reference