🔎 Search Terms
content-mapper
extensions custom declarations
🕗 Version & Regression Information
Using:
"typescript": "7.1.0-dev.20260821.1"
⏯ Playground Link
n/a
💻 Code
Here is the repo with the code: https://github.com/NullVoxPopuli/ember-content-mapper/tree/main/examples/cli-library-v2
As you can see, we have 3 different declaration extensions
.d.ts
.d.gjs.ts
.d.gts.ts
Which makes the package.json exports mapping hard, because for each file type (which can change as refactoring occurs), I'd have to specify different types globs depending on which public entrypoint maps to which file.
It seems no resolving tool (node, rollup, etc) supports arrays of globs for package.json#exports like tsconfig.json#compilerOptions.paths does
🙁 Actual behavior
Too many declaration extension types
🙂 Expected behavior
I'm compliling to JS (not with tsc), so I don't think the emitted imports, nor the declarations, should have any extension other than .d.ts (with the in-declaration imports being extensionless, ofc)
Additional information about the issue
Somewhat related, but I've battled this quite a bit using TS < 7, and have hacked around it via https://github.com/NullVoxPopuli/fix-bad-declaration-output and https://github.com/embroider-build/embroider/blob/5449eb2944cd13548794ceff97df1d86a8c5d53d/packages/addon-dev/src/rollup-declarations.ts#L127
as far as I know, this is an issue in other ecosystems, like MDX
(and any ecosystem that has a custom syntax, and compiles to JS for library publishing)
Potentially related issues:
Docs I know about:
The full expanded tsconfig
{
"compilerOptions": {
"allowJs": true,
"allowImportingTsExtensions": true,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "./declarations",
"declarationMap": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": false,
"noUncheckedIndexedAccess": true,
"noEmitOnError": false,
"rootDir": "./src",
"skipLibCheck": true,
"strict": true,
"target": "es2024",
"types": [],
"verbatimModuleSyntax": true,
"allowSyntheticDefaultImports": true,
"isolatedModules": true,
"preserveConstEnums": true
},
"files": [
"./src/index.ts",
"./src/template-registry.ts",
"./src/utils/format.ts"
],
"include": [
"./src/**/*"
],
"exclude": [
"<repo>/examples/ember-library-v2/declarations"
]
}
I've also tried with adding:
allowArbitraryExtensions: true and rewriteRelativeImportExtensions: true
🔎 Search Terms
content-mapperextensions custom declarations🕗 Version & Regression Information
Using:
⏯ Playground Link
n/a
💻 Code
Here is the repo with the code: https://github.com/NullVoxPopuli/ember-content-mapper/tree/main/examples/cli-library-v2
As you can see, we have 3 different declaration extensions
.d.ts.d.gjs.ts.d.gts.tsWhich makes the package.json
exportsmapping hard, because for each file type (which can change as refactoring occurs), I'd have to specify differenttypesglobs depending on which public entrypoint maps to which file.It seems no resolving tool (node, rollup, etc) supports arrays of globs for package.json#exports like tsconfig.json#compilerOptions.paths does
🙁 Actual behavior
Too many declaration extension types
🙂 Expected behavior
I'm compliling to JS (not with tsc), so I don't think the emitted imports, nor the declarations, should have any extension other than
.d.ts(with the in-declaration imports being extensionless, ofc)Additional information about the issue
Somewhat related, but I've battled this quite a bit using TS < 7, and have hacked around it via https://github.com/NullVoxPopuli/fix-bad-declaration-output and https://github.com/embroider-build/embroider/blob/5449eb2944cd13548794ceff97df1d86a8c5d53d/packages/addon-dev/src/rollup-declarations.ts#L127
as far as I know, this is an issue in other ecosystems, like MDX
(and any ecosystem that has a custom syntax, and compiles to JS for library publishing)
Potentially related issues:
Docs I know about:
The full expanded tsconfig
I've also tried with adding:
allowArbitraryExtensions: trueandrewriteRelativeImportExtensions: true