The following error is thrown when using SwitchScriptTool to compile to a sscript file:
Error: TypeScript standard output: C:/Program Files/Enfocus/Enfocus Switch/SwitchScriptTool/obfuscator/node_modules/@types/switch-scripting/index.d.ts(880,3): error
TS7010: 'close', which lacks return-type annotation, implicitly has an 'any' return type.
C:/Program Files/Enfocus/Enfocus Switch/SwitchScriptTool/obfuscator/node_modules/@types/switch-scripting/index.d.ts(1208,3): error TS7010: 'close', which lacks return-type annotation, implicitly has an 'any' return type.
And then after re-installing @types in local project the error is thrown from the index.d.ts in the switch-scripting local.
Error: Failed to transpile the code: TypeScript failed with exit code 2
Error: TypeScript standard output: node_modules/@types/switch-scripting/index.d.ts(772,3): error TS7010: 'close', which lacks return-type annotation, implicitly has
an 'any' return type.
Can anybody suggest a reason for this, as this is internal to the Enfocus Script Tool? I have attached a screenshot of the error shown in the index.d.ts as is in the switch-scripting folder.
Typescript compile error in index.d.ts
Typescript compile error in index.d.ts
- Attachments
-
- index.d.ts.png (114.85 KiB) Viewed 5324 times
Re: Typescript compile error in index.d.ts
I haven't encountered exactly that, but the line numbering in your index.d.ts doesn't match mine so what version of types-switch-scripting are you including in your project? When you create a new script folder with Switch 2021 Fall, the line in its package.json is:
I had a different problem earlier and the reason was that there was a mismatch with the types-switch-scripting version included in a script folder that was created in a previous version of Switch (2020 Fall at the time) vs the one the updated Switch (2021 Spring) expected so I had to update that to get it working. Maybe that could help in this case, too?
Code: Select all
"@types/switch-scripting": "https://github.com/enfocus-switch/types-switch-scripting/archive/21.1.0.tar.gz"
Re: Typescript compile error in index.d.ts
That line was as follows:
"@types/switch-scripting": "https://github.com/enfocus-switch/types ... 1.0.tar.gz"
This was an old project that came over from the previous version of Switch.
Manually updated the package.json & package-lock.json to the below:
"devDependencies": {
"@types/node": "16.11.6",
"@types/switch-scripting": "https://github.com/enfocus-switch/types ... 1.0.tar.gz"
},
Still did not transpile.
Made a new empty project to check what index.d.ts is under the new version of Switch. That line is still close();. No return type specified.
Project then transpiled by either specifying in index.d.ts:
close():any;
Or changing code to:
// @ts-ignore
close();
"@types/switch-scripting": "https://github.com/enfocus-switch/types ... 1.0.tar.gz"
This was an old project that came over from the previous version of Switch.
Manually updated the package.json & package-lock.json to the below:
"devDependencies": {
"@types/node": "16.11.6",
"@types/switch-scripting": "https://github.com/enfocus-switch/types ... 1.0.tar.gz"
},
Still did not transpile.
Made a new empty project to check what index.d.ts is under the new version of Switch. That line is still close();. No return type specified.
Project then transpiled by either specifying in index.d.ts:
close():any;
Or changing code to:
// @ts-ignore
close();
Re: Typescript compile error in index.d.ts
On further thought that line should probably be:
close():void;
close():void;
Re: Typescript compile error in index.d.ts
OK well that sounds like a bug then – could you file a support case via Enfocus Customer Portal?
--patrik
--patrik
Re: Typescript compile error in index.d.ts
Yes, could do. Would be interested to know what they come back with.
Re: Typescript compile error in index.d.ts
The problem appears because you are probably using a tsconfig.json file which contains the compiler flag noImplicitAny.
I logged it and it will be corrected in the typings file. As a temporary workaround you could remove that compiler flag.
I logged it and it will be corrected in the typings file. As a temporary workaround you could remove that compiler flag.
Re: Typescript compile error in index.d.ts
It would have been this line in tsconfig under compiler options:
"strict":true,
that would have been picking up that no return type was being explicitly stated.
Thanks for the feedback.
"strict":true,
that would have been picking up that no return type was being explicitly stated.
Thanks for the feedback.
-
- Newbie
- Posts: 3
- Joined: Wed Jan 26, 2022 4:35 pm
Re: Typescript compile error in index.d.ts
Hey, this issue has been solved in Switch 2022 Spring.