The closest explanation for what I am trying to do was found here [a link]. Still I am struggling to get my solution to compile.
I have external typings which I would like to use in my project and all of them has .d.ts files with namespace "DS/" which I store in a folder called typings. Below is my folder structure for my simple Angular app.
-MyAppName
--typings
----all my modules d.ts
--src
----app
-tsconfig.json
this is my tsconfig.json file look like below
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"DS/*": [
"typings/*"
],
"*": [
"src/*"
]
}
},
"include": [
"typings/**/*.ts"
],
"exclude": [
"node_modules"
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
I get an error for importing my library as below import { MyModuleName } from 'DS/MyModuleName';
ERROR in ./src/app/app.module.ts Module not found: Error: Can't resolve 'DS/MyModuleName' in 'MyAppName\src\app'
I'm using AngularCLI to build the app. I have failed to configure my tsconfig file to support these externally imported libraries. Not sure what I am doing wrong. Please help.