Skip to content

fix(typescript-estree): fix incorrect backwards-compat augmentation in TS 5.3 #8181

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

Merged
merged 2 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/typescript-estree/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function parseAndGenerateServices<T extends TSESTreeOptions = TSESTreeOptions>(
options.filePath &&
parseAndGenerateServicesCalls[options.filePath] > 1
? createIsolatedProgram(parseSettings)
: getProgramAndAST(parseSettings, hasFullTypeInformation)!;
: getProgramAndAST(parseSettings, hasFullTypeInformation);

/**
* Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve
Expand Down
11 changes: 5 additions & 6 deletions packages/typescript-estree/src/ts-estree/ts-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import type * as ts from 'typescript';

// Workaround to support new TS version features for consumers on old TS versions
// Eg: https://github.com/typescript-eslint/typescript-eslint/issues/2388, https://github.com/typescript-eslint/typescript-eslint/issues/2784
/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error, @typescript-eslint/no-empty-interface */
/* eslint-disable @typescript-eslint/no-empty-interface */
declare module 'typescript' {
/** @ts-ignore - added in TS 4.5, deprecated and converted to a type-alias in TS 5.3 */
export interface AssertClause extends ts.Node {}
/** @ts-ignore - added in TS 4.5, deprecated and converted to a type-alias in TS 5.3 */
export interface AssertEntry extends ts.Node {}
// added in TS 4.5, deprecated in TS 5.3
export interface AssertClause extends ts.ImportAttributes {}
export interface AssertEntry extends ts.ImportAttribute {}
// added in TS 4.9
export interface SatisfiesExpression extends ts.Node {}
// added in TS 5.1
Expand All @@ -16,7 +15,7 @@ declare module 'typescript' {
export interface ImportAttribute extends ts.Node {}
export interface ImportAttributes extends ts.Node {}
}
/* eslint-enable @typescript-eslint/ban-ts-comment, @typescript-eslint/prefer-ts-expect-error, @typescript-eslint/no-empty-interface */
/* eslint-enable @typescript-eslint/no-empty-interface */

export type TSToken = ts.Token<ts.SyntaxKind>;

Expand Down