xstate-tools icon indicating copy to clipboard operation
xstate-tools copied to clipboard

Proposal: rename typegen file to `.d.ts`

Open TheDutchCoder opened this issue 2 years ago • 2 comments

The typegen file for machine is currently called [machine].typegen.ts. Because this file only contains typings, it might be better to rename it to [machine].typegen.d.ts.

I ran into this being an issue while using Nuxt, which processes .ts files, but not .d.ts files for this exact reason.

In the end it wasn't a huge deal, I have moved the machine and typegen file out of the folder that auto-imports .ts files, but might be better to be safe than sorry.

TheDutchCoder avatar Nov 09 '22 12:11 TheDutchCoder

I second and third that. TL;DR it's the standard file extension for TypeScript definition files according to Microsoft documentation and tools.

JetBrains IDEs also treat .d.ts as TypeScript definition files (modules), so do bundlers, testing tools ... everybody. It's also what one gets from services like DefinitelyTyped. It's what tsc creates if you ask for it or Microsoft's dts-gen.

WebMechanic avatar Jan 20 '23 20:01 WebMechanic

That's a great idea (cc. @Andarist)

davidkpiano avatar Jan 21 '23 15:01 davidkpiano