Skip to content

Conversation

@wietekepots-arch
Copy link

Fix TypeScript case-sensitivity errors on case-insensitive filesystems

Fixes #637

Problem

GSAP 3.14 causes TypeScript type-checking to fail on case-insensitive filesystems (macOS, Windows) when projects use checkJs: true in their tsconfig.json.

Two issues were identified:

1. File casing mismatch (TS1149)

The type definition filenames use lowercase (draggable.d.ts), but the module declarations inside them use PascalCase (declare module "gsap/Draggable"). On case-insensitive filesystems, this causes:

error TS1149: File name 'node_modules/gsap/types/Draggable.d.ts' differs from
already included file name 'node_modules/gsap/types/draggable.d.ts' only in casing.

Affected files:

  • draggable.d.ts → module "gsap/Draggable"
  • flip.d.ts → module "gsap/Flip"
  • observer.d.ts → module "gsap/Observer"

2. Missing type annotations in VelocityTracker.js (TS7034/TS7006)

The utils/VelocityTracker.js file lacks type annotations. When consumers use checkJs: true, TypeScript attempts to type-check this file and produces ~60 implicit any errors.

Note: skipLibCheck: true only skips .d.ts files, not .js files.

Solution

  1. Renamed type definition files to match their corresponding JS files:

    • types/draggable.d.tstypes/Draggable.d.ts
    • types/flip.d.tstypes/Flip.d.ts
    • types/observer.d.tstypes/Observer.d.ts
  2. Updated references in types/index.d.ts to use the new filenames

  3. Added // @ts-nocheck to VelocityTracker.js (both src/ and esm/ versions) to prevent TypeScript from checking the untyped JS file. This is appropriate because types are already provided via types/utils/velocity-tracker.d.ts.

Why this happens despite node_modules being excluded

exclude only affects direct compilation scope — it does NOT prevent TypeScript from resolving and checking types from packages you import. And skipLibCheck: true only skips .d.ts files, not .js files.

Testing

After applying this fix, tsc --noEmit passes successfully on macOS.

Fixes greensock#637

Rename single-word type definition files to match their module declarations:
- draggable.d.ts → Draggable.d.ts
- flip.d.ts → Flip.d.ts
- observer.d.ts → Observer.d.ts
- utils/velocity-tracker.d.ts → utils/VelocityTracker.d.ts

Update references in types/index.d.ts accordingly.

The new exports field in package.json (3.14) with explicit type mappings
causes TypeScript to resolve types using the import path casing. On
case-insensitive filesystems, mismatches between reference paths and
import resolution trigger TS1149 errors.

Only single-word filenames are affected since their lowercase versions
differ from their PascalCase module declarations only by case. Multi-word
kebab-case files (e.g., scroll-trigger.d.ts) don't trigger this issue
because they're structurally different from their module names.
@wietekepots-arch wietekepots-arch force-pushed the fix/typescript-case-sensitivity branch from 799280e to 1ebac8e Compare December 23, 2025 09:01
@zaidkhanvmi
Copy link

has this issue been resolved or i should work on this

@jackdoyle
Copy link
Member

We already have it resolved in the next release so there's no "work" you need to do on it. If you just want to get it to work for you locally in the meantime, you can either change the case of the 3 files or you could edit the package.json file to remove the "exports" entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.14.0 – TypeScript case-sensitivity issue with single-word module imports

3 participants