blakeembrey / change-case

Convert strings between camelCase, PascalCase, Capital Case, snake_case and more
MIT License
2.21k stars 92 forks source link

TypeScript support broken in 5.0 #304

Closed Hypnosphi closed 9 months ago

Hypnosphi commented 9 months ago

Reproduction: https://github.com/Hypnosphi/change-case-ts-issue

 % npm run build

> change-case-ts-issue@1.0.0 build
> tsc

index.ts:1:25 - error TS2307: Cannot find module 'change-case' or its corresponding type declarations.

1 import {camelCase} from 'change-case'
blakeembrey commented 9 months ago

See https://github.com/blakeembrey/change-case/pull/303. Rather it’s node ESM support that is broken. This package works correctly in typescript if you have it configured for node 16 resolution, which is the first resolution version of TypeScript supporting ESM.

moltar commented 9 months ago

I think the type support is broken overall.

This is the best tool for diagnostics. The author of the tool was one of the core developers of the TypeScript compiler itself, so he knows this inside and out.

https://arethetypeswrong.github.io/?p=change-case%405.0.1

You can learn more here: https://github.com/arethetypeswrong/arethetypeswrong.github.io

blakeembrey commented 9 months ago

@moltar No, the link you shared says it's correct: CleanShot 2023-10-03 at 10 30 14@2x

I am not supporting CommonJS in this module. Those two resolutions are intentionally unsupported.

blakeembrey commented 9 months ago

I appreciate the link though, I will include this in the README so it's clear I intentionally will not support node10 or CommonJS.