I've got a .mdx
file.
Having the following in mdx.d.ts
:
/// <reference types="@mdx-js/loader" />
import { ComponentType } from "react";
declare module '*.mdx' {
const Component: ComponentType;
export default Component;
}
Makes
import Comp from "./Comp.mdx";
throw "TS2307: Cannot find module './Comp.mdx' or its corresponding type declarations."
However having just the following works:
declare module '*.mdx';
Why is that?
tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["**/*.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}