Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(typescript-estree): correct AST regression introduced by TS4.0 up…
…grade (#2316)
- Loading branch information
1 parent
30fafb0
commit d7fefba
Showing
3 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as semver from 'semver'; | ||
import * as ts from 'typescript'; | ||
|
||
function semverCheck(version: string): boolean { | ||
return semver.satisfies( | ||
ts.version, | ||
`>= ${version}.0 || >= ${version}.1-rc || >= ${version}.0-beta`, | ||
{ | ||
includePrerelease: true, | ||
}, | ||
); | ||
} | ||
|
||
const versions = [ | ||
// | ||
'3.7', | ||
'3.8', | ||
'3.9', | ||
'4.0', | ||
] as const; | ||
type Versions = typeof versions extends ArrayLike<infer U> ? U : never; | ||
|
||
const typescriptVersionIsAtLeast = {} as Record<Versions, boolean>; | ||
for (const version of versions) { | ||
typescriptVersionIsAtLeast[version] = semverCheck(version); | ||
} | ||
|
||
export { typescriptVersionIsAtLeast }; |