-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Generated Database.ts is not compatible with TS 5.0 option verbatimModuleSyntax #436
Comments
Right, this is all something that I can't keep pushing much longer. I'll try to get around to looking into it soon! |
There's another issue with Current hack is postRenderHooks: [(_path, lines) => {
return lines.map(l => l.includes("'./") ? l.replace("\';", '.ts\';') : l)
}], |
The above + ESM-friendly const verbatimModuleSyntaxHook: PostRenderHook = (_, lines) =>
lines.map((line) => {
let x = line;
if (x.startsWith('import ')) {
if (x.includes('default as') && !x.includes(', ')) {
x = x.replace('{ default as ', '').replace('} ', '');
}
} else if (
x.startsWith('export default') &&
!x.startsWith('export default interface')
) {
x = x
.replace('export default', 'export type {')
.replace(';', ' as default };');
}
if (x.includes("from './")) x = x.replace("';", ".js';");
return x;
}); |
To subscribers here, the new importsExtension config field might be helpful. There is still some work to be done though. |
Since TS 5.0 there is a new option called verbatimModuleSyntax which frameworks like SvelteKit set as true by default.
When this option is true,
export default Database
gives the following TS error:An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but 'Database' only refers to a type.
The solution is replacing this line:
Workaround in .kanelrc.js
The text was updated successfully, but these errors were encountered: