Here is a unique module definition using the wildcard character:
declare module 'custom!*' {
const data: string;
export default data;
}
Check out how it's imported:
import * as myData from 'custom!./myCustomData.txt';
But, unfortunately, there's a compiler error:
Error TS2345: The argument type 'typeof 'custom!*'' cannot be assigned to a parameter of type 'string | ((this: HTMLElement, index: number, oldhtml: string) => string)'.
I was really hoping for myData
to be recognized as type string
.