Create File object type in TypeScript Create File object type in TypeScript typescript typescript

Create File object type in TypeScript


Typescript has a defined type for File which represents the file object in JavaScript. Generally you should look for types named as their Javascript countertypes. You can use this type in a parameter annotation for the parameter:

function processFile(file: File) {}