-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathassets.d.ts
More file actions
38 lines (34 loc) · 1.03 KB
/
assets.d.ts
File metadata and controls
38 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Ambient type declarations for non-code asset imports (images, markdown).
*
* These allow TypeScript to understand `import img from './foo.png'` without `@ts-ignore`.
* Webpack's asset loaders resolve these imports to string URLs at build time.
*
* Downstream apps compile hoist-react source via the `@xh/hoist/*` path mapping, but their
* tsconfig `include` patterns typically do not reach this file. Any hoist-react source file
* that imports an asset must therefore pull these declarations in explicitly with a
* triple-slash reference, e.g.:
*
* /// <reference path="../../assets.d.ts" />
* import spinnerImg from './spinner-50px.png';
*/
declare module '*.png' {
const src: string;
export default src;
}
declare module '*.gif' {
const src: string;
export default src;
}
declare module '*.jpg' {
const src: string;
export default src;
}
declare module '*.svg' {
const src: string;
export default src;
}
declare module '*.md' {
const content: string;
export default content;
}