Skip to content

Support using the target + lib options to resolve d.ts per playground session #7

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

Closed
orta opened this issue Jul 10, 2019 · 12 comments
Closed
Labels
Playground Issues that affect the Playground

Comments

@orta
Copy link
Contributor

orta commented Jul 10, 2019

I was trying to help someone with a problem using Object.entries but the playground didn't think it existed. The options panel is great, but doesn't offer a way to specify the lib option. This is a fairly troublesome issue when trying to help people with their modern, up-to-date code.

Perhaps a short-term easy fix would be to default to the latest libs?

Eventually, being able to specify libs (or even a full tsconfig.json as suggested in #4) would probably be best.

@orta orta added Playground Issues that affect the Playground and removed Playground Issues that affect the Playground labels Jul 10, 2019
@orta
Copy link
Contributor Author

orta commented Jul 11, 2019

I've added the extra paragraph from your original post 👍

@orta
Copy link
Contributor Author

orta commented Mar 23, 2020

This got update to ES2015 - so for now I'll close it

@orta orta closed this as completed Mar 23, 2020
@orta orta reopened this Mar 23, 2020
@orta
Copy link
Contributor Author

orta commented Mar 23, 2020

I've been using this as the catch-all for grabbing the right lib files for the TS Playground - so we'll keep it here

@orta orta changed the title Add support for lib options to the playground Support using the target + lib options to resolve d.ts fires uniquely per playground session Mar 23, 2020
@apieceofbart
Copy link

What about stuff like Array.prototype.includes ?

@orta
Copy link
Contributor Author

orta commented Jun 15, 2020

That's what this issue is about - I shipped a deploy change which makes the nightly builds use the ESNext build last week, so you can test out what it will be like for 4.0 here: https://www.staging-typescript.org/play?ts=next

@apieceofbart
Copy link

@orta wow, this looks awesome! thanks a lot!

@orta orta changed the title Support using the target + lib options to resolve d.ts fires uniquely per playground session Support using the target + lib options to resolve d.ts per playground session Jun 25, 2020
@orta
Copy link
Contributor Author

orta commented Jun 26, 2020

microsoft/monaco-typescript#64 - will unblock this feature

@iugo
Copy link

iugo commented Jan 30, 2021

use Object.fromEntries()

setting: "lib": ["ES2019"]

@orta
Copy link
Contributor Author

orta commented Mar 10, 2021

This is in

@orta orta closed this as completed Mar 10, 2021
@adaamz
Copy link

adaamz commented Mar 29, 2021

@orta I don't see the lib option in TSConfig options tab, was this added or what is the resolution for this issue?

@orta
Copy link
Contributor Author

orta commented Mar 29, 2021

You can use twoslash notation to define your own lib: // @lib: ["thing", "other"] - I'm not sure if I'll ever give it a UI

@majellin24
Copy link

majellin24 commented Feb 8, 2022

For anyone arriving here looking for how to enable this like me, I was not able to use the notation mentioned above like:
// @lib: ["thing", "other"]

I tried several variations and other settings changed before bothering to look into some of the other tickets in which this was mentioned.

To potentially save someone a few minutes, the way I was able to get it to work was the following:

/// <reference lib="es2015" />
/// <reference lib="dom" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground Issues that affect the Playground
Projects
None yet
Development

No branches or pull requests

5 participants