Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(lint): add missing TypeScript types #1646

Merged
merged 1 commit into from
Jul 16, 2021
Merged

feat(lint): add missing TypeScript types #1646

merged 1 commit into from
Jul 16, 2021

Conversation

Conaclos
Copy link
Contributor

See discussion #1640

This PR adds missing TypeScript types, such as ArrayConstructor. The array of types is lexicographically ordered.

How

I have retrieved the types using the following commands:

grep -E '^type|interface' lib.es* | cut -d' ' -f2 | cut -d '<' -f1 | sort | uniq
grep -E '^declare type' lib.es* | cut -d' ' -f3 | cut -d '<' -f1 | sort | uniq | wc -l

in TypeScript lib folder.

I removed of this auto-generated list the usual JavaScript classes (Array, String, ...). Note that I also removed Promise of the list. I'm not sure why it was present in the rome list...

Compared to the current rome list, some types were missing:

  • BufferEncoding
  • BufferSource
  • Console
  • NodeJS
  • NodeRequire
  • RequestInit
  • Thenable

Thus, I added these types in the list.

Are types missing?

I deliberately omitted the types of the DOM (lib.dom*) and webworkers (lib.web*). TypeScript declares more than 1000 types for them.

@Conaclos Conaclos requested a review from sebmck as a code owner July 15, 2021 19:41
@Conaclos Conaclos changed the title feat: add missing TypeScript types feat(lint): add missing TypeScript types Jul 15, 2021
@ematipico
Copy link
Contributor

ematipico commented Jul 16, 2021

We should definitely find a better way to define those types in the future. For now, we really appreciate this PR! It brings lot of value! Thank you!

@ematipico ematipico merged commit aa638b1 into rome:main Jul 16, 2021
@Conaclos
Copy link
Contributor Author

@ematipico
The support of declaration files (.d.ts) is certainly the way to go.

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

Successfully merging this pull request may close these issues.

2 participants