Releases: benjamn/ast-types
Release list
Release v0.16.3
Syntax support
This release registers fields that current parsers (Babel, and Oxc as normalized by recast's proposed Oxc integration) emit but ast-types did not define, so visitors traverse the subtrees and deep checks accept the nodes:
TaggedTemplateExpression.typeParametersandTSTypeQuery.typeParameters, for TypeScript instantiation expressions (f<T>as a value,typeof f<T>).JSXOpeningElement.typeParameters, for explicit JSX type arguments (<Component<T> />).ArrayPattern.typeAnnotationandAssignmentPattern.typeAnnotation(shared Flow/TS definitions).ArrayPattern.optional,ObjectPattern.optionalandAssignmentPattern.optional.ClassDeclaration.decoratorsandClassExpression.decorators.TSImportType.options, for import attributes inimport(...)types.VariableDeclaration.kindnow allows"using"and"await using"(explicit resource management).
Each addition is covered by tests that parse the actual syntax with @babel/parser and deep-assert the resulting Program, plus builder tests for node shapes @babel/parser cannot produce directly.
Full changelog: v0.16.2...v0.16.3
Release v0.16.2
The first release on the latest dist-tag since 0.14.2 in September 2020. Everything from 0.15.0 and 0.16.x was published under next, so npm install ast-types has been resolving to a five-year-old build; it now resolves here. Consumers on a ^0.16.1 range, which is most of them by download volume, were already on this line and pick this up as an ordinary patch.
Published from GitHub Actions with npm trusted publishing, so it carries a provenance attestation and no npm token was involved. Verify with npm audit signatures.
Released first as 0.16.2-rc.0 under next, which was checked against recast's full suite: 734 passing and a clean tsc 5.9.3 build, identical to the same suite on 0.16.1.
Syntax support
CallExpression,NewExpressionandOptionalCallExpressionnow carrytypeParameters(TypeScript type arguments such asf<T>()), and the visitor traverses them. Contributed by @phryneas in #954; fixes #343 and facebook/jscodeshift#389.export type * from "mod"andexport type * as ns from "mod"(TypeScript 5.0) are supported.ExportAllDeclarationandExportNamedDeclarationgain anexportKindfield ("value" | "type", default"value"), mirroringImportDeclaration.importKind.ExportNamedDeclaration.specifiersnow acceptsExportNamespaceSpecifier,ExportDefaultSpecifierandExportBatchSpecifier, matching Babel's representation ofexport * as ns from "mod".ExportNamespaceSpecifier.exportedmay be a stringLiteral, per ES2022 arbitrary module namespace names (export * as "ns" from "mod").ExportNamedDeclaration.declarationnow defaults tonull, so Babel ASTs that omit the property for specifier-only exports validate.
Fixes
lib/main.d.tsno longer importsType,NodePathandbuildersunder the same names as the values it declares, which TypeScript 5.4 and later reject underisolatedModules(TS2865). The fix uses only plain aliased imports, so no currently supported TypeScript version loses support. As a side effect,TypeandNodePathimported from the package are now usable as generic types (Type<T>,NodePath<N>). Fixes #948; builds on #950 by @snowystinger.- The test suite type-checks a consumer of the published declarations under TypeScript 4.4, the pinned TypeScript, and TypeScript 5.x, all with
isolatedModules, so declaration-file regressions fail in CI.
Type changes to be aware of
Runtime behavior and builder signatures are unchanged; the changes above only widen what is accepted. Two generated TypeScript types are wider than before, which can affect code that narrowed on the old type:
- Code that reads
specifier.localon every element ofExportNamedDeclaration.specifiersneeds anamedTypes.ExportSpecifier.check(specifier)guard. - Code that reads
exported.nameon anExportNamespaceSpecifierneeds to check forIdentifierfirst.
Testing and infrastructure
@babel/parser(a dev dependency) moves from 7.20.5 to 7.29.8, which also updates the Babel fixture corpus the tests validate against, and the harness now honorssourceTypefrom fixtureoptions.jsonfiles.- Test-only dependencies updated:
glob10,rimraf5,mocha11,ts-node,@types/mocha,@types/esprima. - CI runs again for the first time since 2022, on Node.js 18, 20, 22 and 24, including a check that
src/gen/is up to date withsrc/def/.
Documentation
- The README's
git://clone instruction (a protocol GitHub disabled in 2022), its link into the untrackedlib/directory, and its list of definition modules, which named a file that does not exist and was missinges2016throughes2022, are all corrected. It now has a TypeScript section, which it never had despite the package shipping its own declarations since 0.15.
Full changelog: v0.16.1...v0.16.2
Pre-release version 0.16.2-rc.0
A release candidate for 0.16.2, published under the next dist-tag. Install it with npm install ast-types@0.16.2-rc.0. The latest tag is unchanged.
This is the first release published from GitHub Actions with npm trusted publishing, so it carries a provenance attestation and no npm token was involved.
Syntax support
CallExpression,NewExpressionandOptionalCallExpressionnow carrytypeParameters(TypeScript type arguments such asf<T>()), and the visitor traverses them. Contributed by @phryneas in #954; fixes #343 and facebook/jscodeshift#389.export type * from "mod"andexport type * as ns from "mod"(TypeScript 5.0) are supported.ExportAllDeclarationandExportNamedDeclarationgain anexportKindfield ("value" | "type", default"value"), mirroringImportDeclaration.importKind.ExportNamedDeclaration.specifiersnow acceptsExportNamespaceSpecifier,ExportDefaultSpecifierandExportBatchSpecifier, matching Babel's representation ofexport * as ns from "mod".ExportNamespaceSpecifier.exportedmay be a stringLiteral, per ES2022 arbitrary module namespace names (export * as "ns" from "mod").ExportNamedDeclaration.declarationnow defaults tonull, so Babel ASTs that omit the property for specifier-only exports validate.
Fixes
lib/main.d.tsno longer importsType,NodePathandbuildersunder the same names as the values it declares, which TypeScript 5.4 and later reject underisolatedModules(TS2865). The fix uses only plain aliased imports, so no currently supported TypeScript version loses support. As a side effect,TypeandNodePathimported from the package are now usable as generic types (Type<T>,NodePath<N>). Fixes #948; builds on #950 by @snowystinger.- The test suite type-checks a consumer of the published declarations under TypeScript 4.4, the pinned TypeScript, and TypeScript 5.x, all with
isolatedModules, so declaration-file regressions fail in CI.
Type changes to be aware of
Runtime behavior and builder signatures are unchanged; the changes above only widen what is accepted. Two generated TypeScript types are wider than before, which can affect code that narrowed on the old type:
- Code that reads
specifier.localon every element ofExportNamedDeclaration.specifiersneeds anamedTypes.ExportSpecifier.check(specifier)guard. - Code that reads
exported.nameon anExportNamespaceSpecifierneeds to check forIdentifierfirst.
Testing and infrastructure
@babel/parser(a dev dependency) moves from 7.20.5 to 7.29.8, which also updates the Babel fixture corpus the tests validate against, and the harness now honorssourceTypefrom fixtureoptions.jsonfiles.- Test-only dependencies updated:
glob10,rimraf5,mocha11,ts-node,@types/mocha,@types/esprima. - CI runs again for the first time since 2022, on Node.js 18, 20, 22 and 24, including a check that
src/gen/is up to date withsrc/def/.
Documentation
- The README's
git://clone instruction (a protocol GitHub disabled in 2022), its link into the untrackedlib/directory, and its list of definition modules, which named a file that does not exist and was missinges2016throughes2022, are all corrected. It now has a TypeScript section, which it never had despite the package shipping its own declarations since 0.15.
Full changelog: v0.16.1...v0.16.2-rc.0