Preserve order when generating TypeScript definitions
See original GitHub issueCurrently each time the CLI is executed, the TypeScript definitions come out the same, which is correct, but the order of the definitions is not kept constant.
I’d like to propose some type of ordering which keeps the generated file the same, unless some of the definitions actually changed.
Config used when testing this:
schema: "http://localhost:8080/graphql"
documents: "src/**/*.{ts,tsx}"
generates:
src/gql-types.ts:
plugins:
- "typescript"
- "typescript-operations"
config:
skipTypename: true
declarationKind: 'interface'```
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to preserve variadic type order for conditionally inferred ...
I have the following type definition:
Read more >Documentation - Publishing - TypeScript
If your types are generated by your source code, publish the types with your source code. Both TypeScript and JavaScript projects can generate...
Read more >Documentation - tsc CLI Options - TypeScript
Flag Type Default
‑‑allowJs boolean false
‑‑allowUmdGlobalAccess boolean false
‑‑allowUnreachableCode boolean
Read more >TSConfig Reference - Docs on every TSConfig option
Output Formatting. noErrorTruncation,; preserveWatchOutput and; pretty ... Generate .d.ts files for every TypeScript or JavaScript file inside your project.
Read more >Documentation - Type Declarations - TypeScript
The answer is that there are declaration files describing these built-in objects. A declaration file provides a way to declare the existence of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Prettier won’t change the order of type declarations or properties. It’s pretty annoying that things like the Scalars can change order when generating types from an updated schema that didn’t change anything close to them.
I would kind of expect the types to always be generated in the order they are specified in the schema.
Closing. If someone is still experiencing it, please refer to @ardatan 's reply