Fix TypeScript case-sensitivity errors on case-insensitive filesystems #638
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: truein theirtsconfig.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: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.jsfile lacks type annotations. When consumers usecheckJs: true, TypeScript attempts to type-check this file and produces ~60 implicitanyerrors.Note:
skipLibCheck: trueonly skips.d.tsfiles, not.jsfiles.Solution
Renamed type definition files to match their corresponding JS files:
types/draggable.d.ts→types/Draggable.d.tstypes/flip.d.ts→types/Flip.d.tstypes/observer.d.ts→types/Observer.d.tsUpdated references in
types/index.d.tsto use the new filenamesAdded
// @ts-nochecktoVelocityTracker.js(bothsrc/andesm/versions) to prevent TypeScript from checking the untyped JS file. This is appropriate because types are already provided viatypes/utils/velocity-tracker.d.ts.Why this happens despite
node_modulesbeing excludedexcludeonly affects direct compilation scope — it does NOT prevent TypeScript from resolving and checking types from packages youimport. AndskipLibCheck: trueonly skips.d.tsfiles, not.jsfiles.Testing
After applying this fix,
tsc --noEmitpasses successfully on macOS.