pinqy520 / yoga-layout-wasm

yoga-layout webassembly module
MIT License
29 stars 13 forks source link

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

Open AndriiNeverov opened 4 years ago

AndriiNeverov commented 4 years ago

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 commented 3 years ago

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