unstale

npm / @babel/generator

@babel/generator

What changed in @babel/generator 8, from its official release notes, upgrade guides and advisories. Also covers @types/babel__generator. Sources checked 2026-10-27.

20 breaking1 deprecations2 new APIs and options3 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.8 on npm

@babel/generator 826 changes

Breaking changes 20

  • The undocumented CodeGenerator class has been removed; use the default exported generate function instead.

    8.0.0upgrade guide

  • The jsonCompatibleStrings option was removed; use jsescOption: { json: true } instead.

    8.0.0upgrade guide

  • Importing internal files is disallowed; use the exported API only.

    8.0.0upgrade guide

  • BigIntLiteral.value is a bigint rather than a string; JSON.stringify cannot serialize bigint values.

    8.0.0upgrade guide

  • TSParenthesizedType is no longer generated unless createParenthesizedExpression is enabled; node.extra.parenthesized can indicate parentheses when it is false.

    8.0.0upgrade guide

  • Dynamic import() is represented by an ImportExpression node instead of a CallExpression with an Import callee.

    8.0.0upgrade guide

  • Generated string literals now output non-ASCII characters as-is; ensure JavaScript files are served as UTF-8, or restore the previous behavior with jsescOption: { minimal: false }.

    8.0.0upgrade guide

  • The parameters field is renamed to params on TSCallSignatureDeclaration, TSConstructSignatureDeclaration, TSFunctionType, TSConstructorType, and TSMethodSignature.

    8.0.0upgrade guide

  • The typeAnnotation field is renamed to returnType on TSCallSignatureDeclaration, TSConstructSignatureDeclaration, TSFunctionType, TSConstructorType, and TSMethodSignature.

    8.0.0upgrade guide

  • The superTypeParameters field is renamed to superTypeArguments in ClassDeclaration and ClassExpression.

    8.0.0upgrade guide

  • Class implements entries use TSClassImplements instead of TSExpressionWithTypeArguments; the node uses typeArguments, and qualified expressions are MemberExpression nodes.

    8.0.0upgrade guide

  • TSEnumDeclaration members are now wrapped within a TSEnumBody node.

    8.0.0upgrade guide

  • Exported TSImportEqualsDeclaration is parsed inside an ExportNamedDeclaration, and its isExport field is removed.

    8.0.0upgrade guide

  • TSImportType.argument is renamed to source.

    8.0.0upgrade guide

  • Interface heritage entries use TSInterfaceHeritage instead of TSExpressionWithTypeArguments; the node uses typeArguments, and qualified expressions are MemberExpression nodes.

    8.0.0upgrade guide

  • TSMappedType flattens typeParameter into key and constraint properties on the node itself.

    8.0.0upgrade guide

  • A dotted namespace name such as X.Y is represented as one TSModuleDeclaration whose name is a TSQualifiedName, rather than nested TSModuleDeclaration nodes.

    8.0.0upgrade guide

  • Interpolated template literal types are represented by TSTemplateLiteralType; non-interpolated template literal types retain their existing AST shape.

    8.0.0upgrade guide

  • TSTypeParameter.name is an Identifier node rather than a plain string.

    8.0.0upgrade guide

  • The typeParameters field is renamed to typeArguments on CallExpression, JSXOpeningElement, NewExpression, OptionalCallExpression, TSImportType, TSInstantiationExpression, TSTypeQuery, and TSTypeReference.

    8.0.0upgrade guide

Deprecations 1

  • The legacy import() AST can be requested with createImportExpressions: false, but is deprecated and the parser option will be removed in Babel 9.

    8.0.0upgrade guide

New APIs and options 2

  • When both estree and typescript parser plugins are enabled, Babel creates TSAbstractMethodDefinition nodes.

    8.0.0upgrade guide

  • When both estree and typescript parser plugins are enabled, Babel creates TSPropertyDefinition nodes.

    8.0.0upgrade guide

Fixes and other changes 3

  • Keeps parentheses around optional chaining in tagged expressions.

    8.0.5release notes

  • Improves the check for parentheses around new callees during code generation.

    8.0.0release notes

  • TSTypeQuery.exprName can be a ThisExpression rather than an Identifier for typeof this.

    8.0.0upgrade guide