File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,7 +155,18 @@ async function getCommonJSConfig() {
155155 checkTypeImports : true ,
156156 pattern : {
157157 js : "never" ,
158+ ts : "never" ,
158159 } ,
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+ ] ,
159170 } ,
160171 ] ,
161172 } ,
Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ const otherMod = require("./other-module.cjs");
55// eslint-disable-next-line import/extensions
66const modAgain = require ( "./my-module.js" ) ;
77
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+
813const foo = 1 ;
914const bar = 2 ;
1015
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";
33
44const commonJSModule = require ( "./module-js-common.js" ) ;
55
6+ require ( "../typescript-node-support/my-other-code.ts" ) ;
7+ require ( "../typescript-node-support/my-other-code" ) ;
8+
69const foo = 1 ;
710const bar = 2 ;
811
Original file line number Diff line number Diff line change 11import sum from "./module.js" ;
22import { a , b } from "./named-exports.js" ;
3- // Should be error by default
43import otherSum from "./my-module.ts" ;
54// eslint-disable-next-line import/extensions
65import otherSumAgain from "./my-module" ;
You can’t perform that action at this time.
0 commit comments