Typescript: Add type definitions for Files And Directories API

Created on 23 Jan 2019  路  6Comments  路  Source: microsoft/TypeScript

Search Terms


"Files And Directories API"
FileSystemFileEntry

Suggestion

Add types for the Files And Directories API: https://wicg.github.io/entries-api/

Specifically:

  • FileSystemEntry
  • FileSystemDirectoryEntry
  • FileSystemDirectoryReader
  • FileSystemFileEntry
  • FileSystem

Use Cases

Handling drag/drop of multiple files and/or folders, and gleaning extra information about the dropped files (which is what the API provides).

Checklist

My suggestion meets these guidelines:

  • [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [x] This wouldn't change the runtime behavior of existing JavaScript code
  • [x] This could be implemented without emitting different JS based on the types of the expressions
  • [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • [x] This feature would agree with the rest of TypeScript's Design Goals.
lib.d.ts In Discussion Suggestion help wanted

Most helpful comment

looks like there are official types available.
https://www.npmjs.com/package/@types/wicg-file-system-access

All 6 comments

PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

newcomer here.
in which file would i put the type definitions?

Adding this would only partially help Firefox which even does have some wrong method signatures. All others implement it with webkit prefix attached.

This API is IMO not ready for including in TS:
https://github.com/microsoft/TSJS-lib-generator#when-should-a-dom-api-be-included-here

This specification was published by the Web Platform Incubator Community Group. It is not a W3C Standard nor is it on the W3C Standards Track.

FWIW I drafted the declarations based on the current state of https://wicg.github.io/native-file-system.

https://github.com/fernap3/native-file-system-types/blob/master/native-file-system.d.ts

Happy to receive feedback if anyone wants to contribute.

looks like there are official types available.
https://www.npmjs.com/package/@types/wicg-file-system-access

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uber5001 picture uber5001  路  3Comments

kyasbal-1994 picture kyasbal-1994  路  3Comments

Antony-Jones picture Antony-Jones  路  3Comments

remojansen picture remojansen  路  3Comments

MartynasZilinskas picture MartynasZilinskas  路  3Comments