typescript-boilerplate icon indicating copy to clipboard operation
typescript-boilerplate copied to clipboard

File is not defined when creating a File Obect

Open dush88c opened this issue 4 years ago • 2 comments

should be able to create FIle Object which is available in Typescript

Actual Behavior

GIve error saying File is not defined :

Steps to Reproduce the Problem code sample

var file2 = new File(["asdasdsa"], 'metadata.json');
   console.log(file2.name);

Specifications

  • Version: 4.4
  • Platform:

dush88c avatar Sep 04 '21 06:09 dush88c

What's your compiler flags / full tsc command to reproduce the error?

metachris avatar Sep 04 '21 07:09 metachris

export const delayMillis = (delayMs: number): Promise<void> => new Promise(resolve => setTimeout(resolve, delayMs));

export const greet = (name: string): string => `Hello ${name}`

export const foo = async (): Promise<boolean> => {
  console.log(greet('World'))
  await delayMillis(1000)
  console.log('done')
   var file:File = new File(["asdasdsa"], 'metadata.json');
   console.log(file.name);
  return true
}

I added my File Object creation code sinp into your main.ts and run npm run cli command

dush88c avatar Sep 04 '21 10:09 dush88c