BenjaminAster / TypeScript-types-for-new-JavaScript

TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions

Home Page:https://npm.im/new-javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TSC Standard Library Overlap

Offroaders123 opened this issue · comments

While running tsc over my app, with new-javascript installed, I ran into a few different compilation errors, many of them being overlapped declare class and interface definitions that are already defined in the standard library, which are already defined using the interface declaration type.

I can try to help with this too, wasn't sure how to work on it exactly though. I thought I'd let you know about it before I got too far into it.

I took this screenshot while running tsc -w ./index.d.ts inside a cloned copy of new-javascript on my local machine.

TSC Compilation Errors

The problem was mostly that I referenced the WebWorker lib for some stuff which resulted in the WebWorker type declarations overriding the DOM ones. I now split everything up into index.d.ts for DOM stuff and worker.d.ts for workers. Some stuff like navigator.userAgentData is available both in the main thread and in workers, so I added the navigator extensions directly into the index.d.ts and worker.d.ts files.

Also, some things got added into TypeScript@4.9.4's type declarations so I removed them from this repo.

If you update to new-javascript@0.1.12 and make sure your TypeScript and TSC are on version 4.9.4 it should theoretically work; please let me know if it doesn't.

Worked perfectly! No more errors at all. Thanks for fixing it! Sorry to spam with all of these issues, haha.