I have a project in Angular 6 where I need to integrate a JS library. This library is confidential, so I can't disclose its details. The problem I'm facing is that the TypeScript compiler seems to misinterpret characters like <<24>>
, mistaking them for type casting when they're not. As a result, I encounter the following error during compilation:
error TS8011: 'type arguments' can only be used in a .ts file
The file I'm trying to include is a standard JS file that cannot be modified since it's a minified third-party library that is not accessible via NPM.
Initially, my approach was to exclude the file so the TS compiler would ignore it, but that strategy didn't work. Below is an example of the tsconfig.json configuration that I attempted:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"allowJs": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"exclude": [
"./src/js/MyLib.js"
]
}
I've experimented with both enabling and disabling "allowJs," yet the error persists.
Does anyone have a solution for effectively ignoring this problematic file so that I can simply import it using a script tag?
Thank you!