Skip to content

Commit 329f428

Browse files
committed
enhancement(transformer): Add transformOverloads option
1 parent 072fce0 commit 329f428

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

config/test/webpack.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function ({ typescriptConfig, debug, disableCache }) {
4040
...transformOptions,
4141
debug: debug || transformOptions.debug,
4242
cacheBetweenTests: disableCache ? disableCache !== 'true' : transformOptions.cacheBetweenTests,
43+
transformOverloads: true,
4344
})],
4445
})
4546
}

src/options/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import { TsAutoMockOptions } from './options';
33
export const defaultOptions: TsAutoMockOptions = {
44
debug: false,
55
cacheBetweenTests: true,
6+
transformOverloads: false,
67
};

src/options/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { TsAutoMockCacheOptions } from './cache';
22
import { TsAutoMockDebugOptions } from './debug';
3+
import { TsAutoMockOverloadOptions } from './overload';
34
import { defaultOptions } from './default';
45

56
export interface TsAutoMockOptions {
67
debug: TsAutoMockDebugOptions;
78
cacheBetweenTests: TsAutoMockCacheOptions;
9+
transformOverloads: TsAutoMockOverloadOptions;
810
}
911

1012
let tsAutoMockOptions: TsAutoMockOptions = defaultOptions;

src/options/overload.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { GetOptionByKey } from './options';
2+
3+
export type TsAutoMockOverloadOptions = boolean;
4+
5+
export function GetTsAutoMockOverloadOptions(): TsAutoMockOverloadOptions {
6+
return GetOptionByKey('transformOverloads');
7+
}

tsconfig.playground.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"plugins": [
66
{
77
"transform": "./dist/transformer",
8-
"debug": "console"
8+
"debug": "console",
9+
"transformOverloads": true
910
}
1011
]
1112
},

0 commit comments

Comments
 (0)