question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add type definitions for Files And Directories API

See original GitHub issue

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:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:14
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
gnusivacommented, Dec 6, 2020

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

4reactions
HenningCashcommented, May 17, 2021

Just stumbled across this issue. The initial request of this issues asks for types for the non-standard “File and Directory Entries API”. @types/wicg-file-system-access are types for the “File System Access API”. (And be warned, there is also a third obsolete W3C draft for JS file system access)

Currently, there are more browsers supporting the entries-api than the native-file-system API: https://caniuse.com/mdn-api_filesystementry https://caniuse.com/mdn-api_filesystemhandle It’s still undecided whether Firefox will implement the native file system API: https://mozilla.github.io/standards-positions/#native-file-system. atm Firefox only supports the non-standardized Entries API, even if access to it is prefixed with webkit*: https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support

So… this is the short summary of JS file-system APIs in early 2021.

⚠️ Edit: DefinitelyTyped now also provides types for the Entries API: https://www.npmjs.com/package/@types/wicg-entries-api https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wicg-entries-api

Read more comments on GitHub >

github_iconTop Results From Across the Web

A quick introduction to “Type Declaration” files and adding ...
You can declare a type and entity such as a variable, function, or an n object (that uses this type) at the same...
Read more >
Documentation - Creating .d.ts Files from .js files - TypeScript
Run the TypeScript compiler to generate the corresponding d.ts files for JS files; (optional) Edit your package.json to reference the types. Adding TypeScript....
Read more >
File and Directory Entries API - MDN Web Docs - Mozilla
You can develop apps which read, write, and create files and/or directories in a virtual, sandboxed file system.
Read more >
How to add type definitions for module in subdirectory?
Add the types directory under the files/include like the rest of your TS files. Assuming all of the source files are in src...
Read more >
Generating TypeScript Definition Files from JavaScript
To accomplish that, you can publish Type Declaration files ( *.d.ts )in the root directory of the package you are publishing. TypeScript and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found