sparse-intern-71089
09/30/2019, 3:34 PMwhite-balloon-205
tsconfig.json
.
We just load ts-node
into the Node process to compile-on-module-load .ts
files. It should be reading the tsconfig.json
to decide what TypeScript compilation flags to pass.rhythmic-finland-36256
09/30/2019, 3:45 PMrhythmic-finland-36256
09/30/2019, 3:46 PMnpx tsc -p tsconfig.json
rhythmic-finland-36256
09/30/2019, 3:47 PMmssql.d.ts
file and issue the same tsc
command.rhythmic-finland-36256
09/30/2019, 3:48 PM{
"compileOnSave": true,
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": [
"node_modules/@types/",
"./typings/mssql.d.ts"
]
},
"files": [
"index.ts",
"dummy.ts",
"typings/mssql.d.ts",
"mssql-tasks.ts",
"mssql-serviceuser.ts"
]
}
rhythmic-finland-36256
09/30/2019, 3:50 PMdeclare module 'mssql';
should work if I’m using noImplicitAny
as I’m somehow not defining the types explicitly.rhythmic-finland-36256
09/30/2019, 3:50 PMnoImplicitAny
and those simple declarations. https://github.com/Microsoft/TypeScript/issues/15031rhythmic-finland-36256
09/30/2019, 3:51 PMrhythmic-finland-36256
09/30/2019, 3:53 PMTSError: ⨯ Unable to compile TypeScript:
mssql-tasks.ts(1,22): error TS7016: Could not find a declaration file for module 'mssql'. '/Users/ajaegle/dev/evals/pulumi-tests/testing-dynamic-provider/node_modules/mssql/index.js' implicitly has an 'any' type.
Try `npm install @types/mssql` if it exists or add a new declaration (.d.ts) file containing `declare module 'mssql';
rhythmic-finland-36256
09/30/2019, 3:55 PMrhythmic-finland-36256
09/30/2019, 4:03 PMrhythmic-finland-36256
09/30/2019, 4:06 PMtypeRoots
which must point to a directory similar to node_modules/@types
.rhythmic-finland-36256
09/30/2019, 4:07 PMtypings/<module-name>/<jsfilename>.d.ts
and the following typeRoots
it works:
"typeRoots": [
"node_modules/@types/",
"./typings/"
]
rhythmic-finland-36256
09/30/2019, 4:34 PM