In my src/app.ts, I have:
import DB from '../models'
And in src/models/index.ts, I have:
export default (() => {
if (global.DB) {
return global.DB
}
...
// Do some other stuff
return something
My typings/global.d.ts has:
declare namespace NodeJS {
export interface Global {
DB: any;
}
}
declare var DB: any;
And finally, my tsconfig.json has:
{
"compilerOptions": {
"outDir": "./built",
"allowJs": true,
"target": "es6",
"esModuleInterop": true,
"sourceMap": true
},
"include": [
"./src/**/*"
],
"files": [
"typings/*"
]
}
But I still get the error:
Error: src/models/index.ts(7,16): error TS2339: Property 'DB' does not exist on type 'Global'.
What am I doing incorrectly?
from Typescript: Property 'DB' does not exist on type 'Global'
No comments:
Post a Comment