Fix TypeScript case-sensitivity errors on case-insensitive filesystems#638
Open
wietekepots-arch wants to merge 1 commit intogreensock:masterfrom
Open
Fix TypeScript case-sensitivity errors on case-insensitive filesystems#638wietekepots-arch wants to merge 1 commit intogreensock:masterfrom
wietekepots-arch wants to merge 1 commit intogreensock:masterfrom
Conversation
6e57568 to
799280e
Compare
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.
799280e to
1ebac8e
Compare
|
has this issue been resolved or i should work on this |
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. |
codeCraft-Ritik
left a comment
There was a problem hiding this comment.
Great fix! Resolving case-sensitivity issues and handling checkJs errors improves cross-platform TypeScript compatibility.
Nice approach with file renaming and @ts-nocheck for untyped JS 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.