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

(plugin dts) Error: Syntax not yet supported #189

Closed
1 of 3 tasks
cjh980402 opened this issue Dec 19, 2021 · 0 comments
Closed
1 of 3 tasks

(plugin dts) Error: Syntax not yet supported #189

cjh980402 opened this issue Dec 19, 2021 · 0 comments

Comments

@cjh980402
Copy link

cjh980402 commented Dec 19, 2021

Checklist

  • I can reproduce this issue when running this plugin on its own.
    Other plugins, such as node-resolve are known to cause issues.
  • I am running this plugin on .d.ts files generated by TypeScript.
    The plugin can consume .ts and even .js files (with allowJs: true), but this is known to cause issues.
  • This issue is not related to rolling up @types.
    The plugin ignores these by default, unless respectExternal is set. @types can contain hand-crafted code which is known to cause issues.

I got error when I use extends null.
egoist/tsup#500

Code Snipped

To reproduce that error, I changed ./build/src/index.ts.

// Your code that is causing problems.
import { PluginImpl } from "rollup";
import ts from "typescript";

export class MyClass extends null {
  static a = 10;
}
export interface Options {
    /**
     * The plugin will by default flag *all* external libraries as `external`,
     * and thus prevent them from be bundled.
     * If you set the `respectExternal` option to `true`, the plugin will not do
     * any default classification, but rather use the `external` option as
     * configured via rollup.
     */
    respectExternal?: boolean;
    /**
     * In case you want to use TypeScript path-mapping feature, using the
     * `baseUrl` and `paths` properties, you can pass in `compilerOptions`.
     */
    compilerOptions?: ts.CompilerOptions;
}
declare const plugin: PluginImpl<Options>;
export default plugin;

Error Message

Change the ./build/src/index.ts and run command npm run build.

// The Error Message thrown by rollup / the plugin.
./.build/src/index.js → ./dist/rollup-plugin-dts.mjs, ./dist/rollup-plugin-dts.cjs...
created ./dist/rollup-plugin-dts.mjs, ./dist/rollup-plugin-dts.cjs in 188ms

./.build/src/index.d.ts → ./dist/rollup-plugin-dts.d.ts...
[!] (plugin dts) Error: Syntax not yet supported

  2 | import ts from "typescript";
  3 |
> 4 | declare class MyClass extends null {
    |                               ^^^^
  5 |   static a = 10;
  6 | }
  7 | interface Options {
.build/src/index.d.ts
Error: Syntax not yet supported

  2 | import ts from "typescript";
  3 |
> 4 | declare class MyClass extends null {
    |                               ^^^^
  5 |   static a = 10;
  6 | }
  7 | interface Options {
    at convertExpression (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:451:15)
    at DeclarationScope.convertHeritageClauses (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:920:36)
    at Transformer.convertClassOrInterfaceDeclaration (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1279:15)
    at Transformer.convertStatement (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1215:25)
    at new Transformer (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1166:18)
    at convert (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1157:25)
    at Object.transform (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1473:31)
    at transformFile (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1571:50)
    at Object.transform (/home/ubuntu/github-clone/test/rollup-plugin-dts/.build/rollup.config.js:1578:33)
    at /home/ubuntu/github-clone/test/rollup-plugin-dts/node_modules/rollup/dist/shared/rollup.js:22706:25
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

1 participant