File tree Expand file tree Collapse file tree 5 files changed +23
-1
lines changed Expand file tree Collapse file tree 5 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,18 @@ async function getCommonJSConfig() {
155
155
checkTypeImports : true ,
156
156
pattern : {
157
157
js : "never" ,
158
+ ts : "never" ,
158
159
} ,
160
+ // Allow to have `ts` extension in `require` for compatibility with Node.js built-in typescript support
161
+ pathGroupOverrides : [
162
+ {
163
+ pattern : "*.ts" ,
164
+ patternOptions : {
165
+ matchBase : true ,
166
+ } ,
167
+ action : "ignore" ,
168
+ } ,
169
+ ] ,
159
170
} ,
160
171
] ,
161
172
} ,
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ const otherMod = require("./other-module.cjs");
5
5
// eslint-disable-next-line import/extensions
6
6
const modAgain = require ( "./my-module.js" ) ;
7
7
8
+ require ( "../typescript-node-support/my-other-code.ts" ) ;
9
+ require ( "../typescript-node-support/my-other-code" ) ;
10
+ // eslint-disable-next-line import/extensions
11
+ require ( "./my-module-1.js" ) ;
12
+
8
13
const foo = 1 ;
9
14
const bar = 2 ;
10
15
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ module . exports . a = 1 ;
4
+ module . exports . b = 2 ;
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ import otherMod from "././other-module.cjs";
3
3
4
4
const commonJSModule = require ( "./module-js-common.js" ) ;
5
5
6
+ require ( "../typescript-node-support/my-other-code.ts" ) ;
7
+ require ( "../typescript-node-support/my-other-code" ) ;
8
+
6
9
const foo = 1 ;
7
10
const bar = 2 ;
8
11
Original file line number Diff line number Diff line change 1
1
import sum from "./module.js" ;
2
2
import { a , b } from "./named-exports.js" ;
3
- // Should be error by default
4
3
import otherSum from "./my-module.ts" ;
5
4
// eslint-disable-next-line import/extensions
6
5
import otherSumAgain from "./my-module" ;
You can’t perform that action at this time.
0 commit comments