Commit 8a6d72a 1 parent e56943e commit 8a6d72a Copy full SHA for 8a6d72a
File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ describe("TypeScriptLoader", () => {
40
40
try {
41
41
cfg . load ( path . resolve ( fixturesPath , "invalid.fixture.ts" ) ) ;
42
42
fail ( "Should fail to load invalid TS" ) ;
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
44
} catch ( error : any ) {
44
45
expect ( error ?. name ) . toStrictEqual ( "TypeScriptCompileError" ) ;
45
46
}
@@ -72,6 +73,7 @@ describe("TypeScriptLoader", () => {
72
73
try {
73
74
await cfg . load ( path . resolve ( fixturesPath , "invalid.fixture.ts" ) ) ;
74
75
fail ( "Should fail to load invalid TS" ) ;
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
77
} catch ( error : any ) {
76
78
expect ( error ?. name ) . toStrictEqual ( "TypeScriptCompileError" ) ;
77
79
}
@@ -104,7 +106,7 @@ describe("TypeScriptLoader", () => {
104
106
105
107
expect ( ( ) =>
106
108
cfg . load ( path . resolve ( fixturesPath , "invalid.fixture.ts" ) ) ,
107
- ) . toThrowError ( ) ;
109
+ ) . toThrow ( ) ;
108
110
} ) ;
109
111
} ) ;
110
112
} ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,9 @@ describe("TypeScriptLoader", () => {
37
37
38
38
it ( "should fail on parsing an invalid TS file" , ( ) => {
39
39
const filePath = path . resolve ( fixturesPath , "invalid.fixture.ts" ) ;
40
- expect ( ( ) => loader ( filePath , readFixtureContent ( filePath ) ) ) . toThrowError ( ) ;
40
+ expect ( ( ) : unknown =>
41
+ loader ( filePath , readFixtureContent ( filePath ) ) ,
42
+ ) . toThrow ( ) ;
41
43
} ) ;
42
44
43
45
it ( "should use the same instance of jiti across multiple calls" , ( ) => {
@@ -66,9 +68,9 @@ describe("TypeScriptLoader", () => {
66
68
67
69
beforeEach ( ( ) => {
68
70
stub = jest . spyOn ( jiti , "default" ) . mockImplementation ( ( ( ) => ( ) => {
69
- // eslint-disable-next-line @typescript-eslint/no -throw-literal
71
+ // eslint-disable-next-line @typescript-eslint/only -throw-error
70
72
throw unknownError ;
71
- } ) as any ) ;
73
+ } ) as never ) ;
72
74
73
75
loader = TypeScriptLoader ( ) ;
74
76
} ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ import { TypeScriptCompileError } from "./typescript-compile-error.js";
5
5
6
6
export function TypeScriptLoader ( options ?: JITIOptions ) : Loader {
7
7
const loader = jiti ( "" , { interopDefault : true , ...options } ) ;
8
- return ( path : string ) => {
8
+ return ( path : string ) : unknown => {
9
9
try {
10
- const result = loader ( path ) ;
10
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11
+ const result : { default ?: unknown } = loader ( path ) ;
11
12
12
13
// `default` is used when exporting using export default, some modules
13
14
// may still use `module.exports` or if in TS `export = `
You can’t perform that action at this time.
0 commit comments