-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip importing export types in TS (#4754)
Summary: A fix for a typescript generation bug discovered from the work in #4753, with efforts to enable checking for all TS generated files #4745 This fixes a class of Typescript errors in generated typescript files with TS checking enabled: ``` /src/__generated__/mutation.graphql.ts(11,27): error TS2305: Module '"relay-runtime"' has no exported member 'Mutation'. /src/__generated__/mutation.graphql.ts(11,27): error TS6133: 'Mutation' is declared but its value is never read. ``` The root cause is the exported type is both not exported by the TS types, and not used due to typescript using the `export default` syntax. Where flow would generate the following export: ``` module.exports = ((node/*: any*/)/*: Mutation< validateMutationTest9ChangeNameIncludeMutation$variables, validateMutationTest9ChangeNameIncludeMutation$data, >*/); ``` Typescript would generate the following, not using the `Mutation` type: ``` export default node; ``` This fix removes the extraneous import type when the language is set as typescript. Pull Request resolved: #4754 Differential Revision: D60604034 fbshipit-source-id: f38fc80bba3b549a22ebbca544dca1f9e940cce0
- Loading branch information
1 parent
e1668bb
commit 0f49c2e
Showing
6 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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