Including typings for third-party library gives module not found via angular CLI?
Long story short: You need to rename your folder with types and add them to the type roots.
Step #1
In your folder with types (./types) create new folder "apple-mapkit-js"
Step #2
Add your custom index.d.ts there
Step #3 Point TSC to your custom types. Update tsconfig.app.json with new typeRoots:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"typeRoots" : ["./src/types/", "node_modules/@types"]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
}
Step #4 Update your import to the
import * as mapkit from 'apple-mapkit-js'
Now it works.
But what was the issue?
Actually, according to the TypeScript documentation, if you specify typeroots, all other resources become "invisible" for the typescript, so tsc just didn't see your declarations
P.S. Checked on the Angular 9 app.