I have been experimenting with a TypeScript function lately. To speed up my testing process, I decided to utilize ts-jest
.
However, I stumbled upon an issue that seems tricky to resolve. Despite exploring various ts-jest
options, I couldn't find a solution. The function only accepts string input.
function tsFunc(arg:string){
if (typeof(arg)!=='string'){
throw new TypeError('....')
}
}
Unfortunately, I am unable to perform tests as calling tsFunc(5)
won't compile in the test files.
Any suggestions on how to tackle this challenge?