Debian Codegraph @

packages/babel-helper-create-class-features-plugin/src/typescript.ts

raw
1 import type { NodePath } from "@babel/traverse";
2 import type * as t from "@babel/types";
3
4 export function assertFieldTransformed(
5 path: NodePath<t.ClassProperty | t.ClassDeclaration>,
6 ) {
7 // TODO (Babel 8): Also check path.node.definite
8
9 if (path.node.declare) {
10 throw path.buildCodeFrameError(
11 `TypeScript 'declare' fields must first be transformed by ` +
12 `@babel/plugin-transform-typescript.\n` +
13 `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` +
14 `that it runs before any plugin related to additional class features:\n` +
15 ` - @babel/plugin-proposal-class-properties\n` +
16 ` - @babel/plugin-proposal-private-methods\n` +
17 ` - @babel/plugin-proposal-decorators`,
18 );
19 }
20 }