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

New Set methods are missing in types #13024

Closed
KilianB opened this issue Aug 2, 2024 · 4 comments
Closed

New Set methods are missing in types #13024

KilianB opened this issue Aug 2, 2024 · 4 comments
Labels
bug Something isn't working typescript Something for TypeScript

Comments

@KilianB
Copy link
Contributor

KilianB commented Aug 2, 2024

What version of Bun is running?

1.1.21+70ca2b76c

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What steps can reproduce the bug?

JSC already includes the new set operators union intersection difference symmetricDifference, but those are not reflected in the types

bun repl
Welcome to Bun v1.1.21
Type ".help" for more information.
[!] Please note that the REPL implementation is still experimental!
    Don't consider it to be representative of the stability or behavior of Bun overall.
> console.log(Set.prototype);
Set {
  add: [Function: add],
  clear: [Function: clear],
  delete: [Function: delete],
  entries: [Function],
  forEach: [Function: forEach],
  has: [Function: has],
  keys: [Function],
  size: [Getter],
  values: [Function],
  union: [Function: union],
  intersection: [Function: intersection],
  difference: [Function: difference],
  symmetricDifference: [Function: symmetricDifference],
  isSubsetOf: [Function: isSubsetOf],
  isSupersetOf: [Function: isSupersetOf],
  isDisjointFrom: [Function: isDisjointFrom],
  [Symbol(Symbol.iterator)]: [Function],
}

What is the expected behavior?

I would expect with the default setup after running bun init for these types to be present and intellisense being able to pick them up.

What do you see instead?

Methods do not get suggested.

Additional information

Included in typescript 5.5 https://github.com/tc39/proposal-set-methods

@KilianB KilianB added bug Something isn't working typescript Something for TypeScript labels Aug 2, 2024
@ghost
Copy link

ghost commented Aug 4, 2024

Set is not a part of bun-types.

try to edit your tsconfig.json:

"target": "ESNext",
"module": "ESNext",
"lib": ["ESNext"],

@KilianB
Copy link
Contributor Author

KilianB commented Aug 5, 2024

Set not being part of bun-types might actually be the issue, or some other part of the project setup did not work properly. Maybe I am even confusing how the lib versions get resolved.

I am using your above mentioned setup but still run into the issue that the types are not defined.

// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",

Screenshot 2024-08-05 at 08 35 56

The pr with the types got merged into typescript in May. microsoft/TypeScript#57230
Is this type package automatically updated or are there release intervals for this? Is this maybe an issue with the bun install cache?

Do the type packages depend on the typescript version vscode is picking up or are they standalone packages that are installed on a as needed basis?

@ghost
Copy link

ghost commented Aug 5, 2024

run tsc --noEmit. if there is no error in result, this is issue in VSCode. otherwise, try bun update --latest or bun i -D typescript@latest

Do the type packages depend on the typescript version vscode is picking up

yes.

@KilianB
Copy link
Contributor Author

KilianB commented Aug 5, 2024

Thanks, this was actually the missing piece. The ts version not correctly being set in vscode.

Screenshot 2024-08-05 at 10 56 32

@KilianB KilianB closed this as completed Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript Something for TypeScript
Projects
None yet
Development

No branches or pull requests

1 participant