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

[extends null] DTS Build Error, Syntax not yet supported #500

Closed
cjh980402 opened this issue Dec 17, 2021 · 7 comments
Closed

[extends null] DTS Build Error, Syntax not yet supported #500

cjh980402 opened this issue Dec 17, 2021 · 7 comments
Labels
bug Something isn't working released upstream

Comments

@cjh980402
Copy link

cjh980402 commented Dec 17, 2021

DTS Build start
DTS Build error
Error: Syntax not yet supported

> 1 | declare class MyClass extends null {
    |                               ^^^^

extends null is valid syntax but cannot build dts for extends null.

@ChelesteWang
Copy link
Contributor

Can you elaborate and provide a duplicate demo?

@cjh980402
Copy link
Author

cjh980402 commented Dec 19, 2021

src/index.ts

export class Myclass extends null {
    
}

tsup.config.json

{
  "clean": true,
  "dts": true,
  "entry": ["src/index.ts"],
  "format": ["cjs", "esm"],
  "minify": true,
  "sourcemap": true,
  "splitting": false,
  "target": "es2020",
  "tsconfig": "./tsconfig.json"
}

tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "alwaysStrict": true,
    "target": "es2020",
    "module": "commonjs",
    "declaration": true,
    "outDir": "./dist",
    "moduleResolution": "node",
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true
  }
}

tsup error log

CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v5.11.6
CLI Using tsup config: /home/ubuntu/node-test/tsup.config.json
CLI Target: es2020
CLI Cleaning output folder
CJS Build start
ESM Build start
CJS ⚡️ Build success in 34ms
ESM ⚡️ Build success in 13ms
ESM dist/index.mjs     83.00 B
ESM dist/index.mjs.map 150.00 B
CJS dist/index.js     667.00 B
CJS dist/index.js.map 158.00 B
DTS Build start
DTS Build error
Error: Syntax not yet supported

> 1 | declare class Myclass extends null {
    |                               ^^^^
  2 | }
  3 |
  4 | export { Myclass };
    at convertExpression (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:7370:15)
    at DeclarationScope.convertHeritageClauses (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:7718:32)
    at Transformer.convertClassOrInterfaceDeclaration (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:8037:15)
    at Transformer.convertStatement (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:7979:23)
    at new Transformer (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:7936:16)
    at convert (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:7927:27)
    at Object.transform (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:8198:29)
    at transformFile (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:8268:46)
    at Object.writeFile (/home/ubuntu/node-test/node_modules/tsup/dist/rollup.js:8289:25)
    at Object.writeFile (/home/ubuntu/node-test/node_modules/typescript/lib/typescript.js:18191:14)

@ChelesteWang
Copy link
Contributor

in your index.ts

export class Myclass extends null {
    
}

your class Should not be extends null , This is grammatically impermissible

@cjh980402
Copy link
Author

extends null is valid syntax.
https://node.green/#ES2015-functions-class-extends-null
image

@egoist
Copy link
Owner

egoist commented Dec 19, 2021

@cjh980402
Copy link
Author

cjh980402 commented Dec 24, 2021

@egoist
This problem is solved in new version(4.1.0) of rollup-plugin-dts. (https://github.com/Swatinem/rollup-plugin-dts/blob/master/CHANGELOG.md)

Then, how can update rollup-plugin-dts version in tsup?

@egoist egoist closed this as completed in e7aba26 Dec 24, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 5.11.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released upstream
Projects
None yet
Development

No branches or pull requests

3 participants