Skip to content

Commit

Permalink
feat: Add .cts to support typescript 4.7 (#90)
Browse files Browse the repository at this point in the history
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
  • Loading branch information
cspotcode and phated committed Jun 29, 2022
1 parent c81a9d4 commit c1ffa36
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ var extensions = {
},
},
],
'.cts': ['ts-node/register'],
'.tsx': [
'ts-node/register',
'sucrase/register/tsx',
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/cts/0/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"ts-node": "^10.8.0",
"typescript": "^4.7.4"
}
}
19 changes: 19 additions & 0 deletions test/fixtures/cts/0/test.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var test: {
data: {
trueKey: boolean;
falseKey: boolean;
subKey: {
subProp: number;
};
};
} = {
data: {
trueKey: true,
falseKey: false,
subKey: {
subProp: 1,
},
},
};

export default test;
11 changes: 11 additions & 0 deletions test/fixtures/cts/0/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"sourceMap": true,
"outDir": ".tmp"
}
}
4 changes: 2 additions & 2 deletions test/fixtures/ts/0/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"ts-node": "^7.0.1",
"typescript": "^3.2.2"
"ts-node": "^10.8.0",
"typescript": "^4.7.4"
}
}
4 changes: 2 additions & 2 deletions test/fixtures/tsx/0/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"ts-node": "^7.0.1",
"typescript": "^3.2.2"
"ts-node": "^10.8.0",
"typescript": "4.7.4"
}
}
1 change: 1 addition & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ describe('interpret.extensions', function () {

switch (extension) {
case '.ts':
case '.cts':
case '.tsx':
case '.esm.js':
case '.babel.tsx':
Expand Down

0 comments on commit c1ffa36

Please sign in to comment.