Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 675 Bytes

non-ts-files.md

File metadata and controls

20 lines (15 loc) · 675 Bytes
id title sidebar_label
non_ts_files
Troubleshooting Handbook: Images and other non-TS/TSX files
Images and other non-TS/TSX files

Use declaration merging:

// declaration.d.ts
// anywhere in your project, NOT the same name as any of your .ts/tsx files
declare module "*.png";

// importing in a tsx file
import * as logo from "./logo.png";

Note that tsc cannot bundle these files for you, you will have to use Webpack or Parcel.

Related issue: microsoft/TypeScript-React-Starter#12 and StackOverflow