I have declared namespace in a .d.ts which should be globally available like so:
/src/typings/content.d.ts
import * as something from 'something';
declare namespace Content {
...
type Object = internal.Object;
}
I want to use this namespace for a Interface in a TSX file:
import * as React from 'react';
interface ExampleComponentProps {
example: Content.Object;
}
export const ExampleComponent: React.FunctionComponent<ExampleComponentProps> = ({ example }) => {
return <div>{example}</div>;
};
Typescript now tells me: Cannot find namespace 'Content'
.
My tsconfig looks like this:
{
"compilerOptions": {
// General settings for code interpretation
"target": "esnext",
"module": "commonjs",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"noEmit": true,
"noEmitOnError": true,
"removeComments": false,
"resolveJsonModule": true,
"baseUrl": "./src",
...
},
"include": [
"./src/typings/*.d.ts",
"./src/**/*"
]
}