-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: support .d.mts
and .d.cts
#3000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/sandbox/src/index.ts
Outdated
@@ -314,12 +314,15 @@ export const createTypeScriptSandbox = ( | |||
return (firstJS && firstJS.text) || "" | |||
} | |||
|
|||
const isDtsFile = (name: string) => /\.d\.[cm]?ts$/.test(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may also want to support .d.*.ts
, e.g. .d.css.ts
. https://github.com/microsoft/DefinitelyTyped-tools/blob/7a8a32513cbbe5a2af5c3e39e056117b3c14c390/packages/utils/src/miscellany.ts#L97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, good to know. Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda frustrating that there's no common way to access this one regex, but, oh well.
Not sure how much it matters but it may technically be more performant to store the regexp object off in a var somewhere and reuse it. not sure if V8 performs that optimization or not, though.
Also will require a package release.
Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3000.centralus.5.azurestaticapps.net |
https://www.typescriptlang.org/docs/handbook/modules/reference.html#node16-nodenext
For example, package
shikiji
is an ESM-only package that only ships.mjs
and.d.mts
. The ATA failed to work as failed to find.d.ts
and start looking for@types/shikiji
, which do not exist either:https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgcwKYwBLGQCwDbY4ypRwC+cAZlBCHAOQDOOwA1sAFbD0BQPAxhAB2jeAEM4AXjhiA7mODw0mQgVzEoACgCUQA