Skip to content
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

error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier #1

Open
AndriiNeverov opened this issue Jul 1, 2020 · 1 comment

Comments

@AndriiNeverov
Copy link

I'm trying to include this module into an Ionic app and get the following on ionic serve:

[ng] ERROR in node_modules/yoga-layout-wasm/index.d.ts:26:1 - error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
[ng] 26 const mod: YogaWasm

I have:

"yoga-layout": "^1.9.3",
"yoga-layout-wasm": "^1.9.3-alpha.7",
"@types/yoga-layout": "^1.9.2",

NOTE: also there is another error, but that one can be at least solved by setting:

"compilerOptions": {
    "allowSyntheticDefaultImports": true,
[ng] ERROR in node_modules/yoga-layout-wasm/index.d.ts:1:8 - error TS1259: Module '"/priv/src/Startup/Embedded/hello1/node_modules/@types/yoga-layout/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
[ng] 1 import Yoga from "yoga-layout";
[ng]          ~~~~
[ng]   node_modules/@types/yoga-layout/index.d.ts:413:1
[ng]     413 export = Yoga;
[ng]         ~~~~~~~~~~~~~~
[ng]     This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
@VaskillerDev
Copy link

This is because CommonJS modules are being created, instead of ESM. Change in your rollup.config.js format from cjs to esm, then execute npm run build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants