Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take another sweep for known globals #3805

Closed
Conduitry opened this issue Oct 27, 2019 · 8 comments
Closed

Take another sweep for known globals #3805

Conduitry opened this issue Oct 27, 2019 · 8 comments

Comments

@Conduitry
Copy link
Member

(Opening in favor of sveltejs/rollup-plugin-svelte#73)

Our list of known globals is still somehow missing Event. We should probably take another sweep (through MDN? somewhere else?) for a list of the the most famous ones and add them to the set here.

@Joxtacy
Copy link
Contributor

Joxtacy commented Oct 27, 2019

Here is Event, and some other interfaces based on it, listed.

And just for reference, here are all globals on MDN listed.

How to decide what to add to the list, I don't know. But please let me know if I can help in any way.

@tomblachut
Copy link

Folks at TypeScript generate comprehensive files:

https://github.com/microsoft/TypeScript/blob/master/lib/lib.dom.d.ts
that file has 863 declare statements, 135 of which are event handlers. This is a lot more than current Svelte globals and doesn't include builtins like Array 😅

https://github.com/microsoft/TypeScript/blob/master/lib/lib.es5.d.ts that one contains basic globals, around 40 of them.

Anyway https://github.com/microsoft/TypeScript/tree/master/lib directory contains various language editions and README with info related to how they collect those declarations.

This is very interesting, I had no idea global namespace is so large

@Joxtacy
Copy link
Contributor

Joxtacy commented Oct 27, 2019

That is a heckin' lot of declarations! 😅

The difference though seems to be that the TypeScript crew needs to have declarations for all ECMAScript objects and functions and whatnot to be able to provide proper typing when using those things in your TypeScript code. In Svelte, we only need to declare the names of globals so that Svelte knows what objects and functions are actually declared when compiling the code.

But maybe it would make sense for Svelte to also check functions and other declarations nested on global objects as well. 🤔I feel like that's an entirely different discussion though. 🤷‍♂️

And please correct me if I'm wrong here.

@mustafa0x
Copy link
Contributor

Object.getOwnPropertyNames(window).

Gives 917 in latest Chrome. The last ~25 are injected by Dev Tools.

@aredridel
Copy link
Contributor

I'm getting warnings doing normal event handler things referring to HTMLInputElement and friends, because they're not in the list.

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 26, 2021
@stale stale bot removed the stale-bot label Jun 27, 2021
@stale
Copy link

stale bot commented Dec 25, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@baseballyama
Copy link
Member

#7786 registered all global objects / functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants