-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: restore typescript 5.6 compatibility #301
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import ts from "typescript"; | ||
import tsThree from "typescript-3"; | ||
import tsFourSeven from "typescript-4.7"; | ||
import tsFiveFive from "typescript-5.5"; | ||
import tsFiveSix from "typescript-5.6"; | ||
import path from "node:path"; | ||
|
||
export const tsModules = <const>[ | ||
["3.6.5", tsThree, "typescript-3"], | ||
["4.7.4", tsFourSeven, "typescript-4.7"], | ||
["5.5.4", tsFiveFive, "typescript-5.5"], | ||
["5.6.3", tsFiveSix, "typescript-5.6"], | ||
["Latest", ts, "typescript"], | ||
Comment on lines
+12
to
13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, 5.6.3 and |
||
]; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,14 +34,20 @@ describe(`Extra Tests`, () => { | |
}); | ||
|
||
describe(`ts-node register script`, () => { | ||
/** Yarn sometimes outputs bold text, which makes these tests flakey */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests were failing for me when I ran them locally. The output of
|
||
function stripAnsi(str: string) { | ||
// eslint-disable-next-line no-control-regex | ||
return str.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, ""); | ||
} | ||
|
||
test(`Works with --transpileOnly`, () => { | ||
const res = execSync("yarn g:ts-node --transpileOnly src/index.ts", { cwd: projectRoot }).toString(); | ||
expect(res).toMatch(/^null($|\r?\n)/m); | ||
expect(stripAnsi(res.trim())).toEqual("null"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, instead of caring about the newline (which can be different between windows and mac), I just |
||
}); | ||
|
||
test(`Works with --typeCheck`, () => { | ||
const res = execSync("yarn g:ts-node --typeCheck src/index.ts", { cwd: projectRoot }).toString(); | ||
expect(res).toMatch(/^null($|\r?\n)/); | ||
expect(stripAnsi(res.trim())).toEqual("null"); | ||
}); | ||
}); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See PR description - both of these methods are not marked as
@internal
.This is the exact implementation of
getOriginalSourceFile
: https://github.com/microsoft/TypeScript/blob/c8a7d589e647e19c94150d9892909f3aa93e48eb/src/compiler/utilities.ts#L5416-L5419