daidodo / format-imports

JavaScript and TypeScript Import/Export Sorter
MIT License
45 stars 2 forks source link

Support TypeScript 4.9 `satisfies` operator #17

Closed karlhorky closed 1 year ago

karlhorky commented 1 year ago

Hi @daidodo 👋 Hope that you are well!

Is your feature request related to a problem? Please describe.

It would be great to be able to use the TypeScript 4.9 satisfies operator!

However, currently, format-imports identifies this as an unused import:

import {AType} from '../a.js'; // 💥 This will be removed as an "unused import"

const a = 'abc' satisfies AType;

Describe the solution you'd like

The import of the type should not be marked as unused.

Describe alternatives you've considered

Ignore all type imports using keepUnused

Additional context

I'm using VS Code 1.73.1 which has TS 4.8.4 built in, but I'm using 4.9.3 via my node_modules:

Screenshot 2022-11-21 at 17 44 56

One thing I could imagine is that the format-import VS Code extension needs a newer version of VS Code to get full TS 4.9 support... 🤔 Is this how it works?

daidodo commented 1 year ago

Thanks for the feedback!

You are probably right that the fix would be updating the built-in TS.

daidodo commented 1 year ago

This should be fixed in 7.5.2.

karlhorky commented 1 year ago

Nice, it works for me, thanks! 🙌 Closing.

I guess it was mostly this commit?