rbxts-flamework / core

Flamework is an extensible game framework. It requires typescript and offers many useful features.
MIT License
101 stars 8 forks source link

Inconsistent ID generation for .d.ts files #109

Open aidanborne opened 1 month ago

aidanborne commented 1 month ago

Flamework's ID generation has differing behavior for .d.ts files depending on whether or not the file is a descendant of a rootDir. .d.ts files that ARE a descendant of a rootDir (such as type declarations for .lua files or a types.d.ts file) won't have their extension removed, resulting in IDs like @package/types.d.ts@MyInterface. At the same time, .d.ts files that AREN'T a descendant of a rootDir will always have their extension removed, resulting in IDs like @package/types@MyInterface. This behavior discrepancy causes ID mismatches for packages that use declarations from .d.ts files.

Package A

// types.d.ts
export interface MyInterface {}
// .ts file
Flamework.id<MyInterface>() // @package/types.d.ts@MyInterface 

Package B

// .ts file (with MyInterface imported)
Flamework.id<MyInterface>() // @package/types@MyInterface