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

TS Playground does not provide ES2017 Object types #82

Closed
saschanaz opened this issue Oct 9, 2019 · 11 comments
Closed

TS Playground does not provide ES2017 Object types #82

saschanaz opened this issue Oct 9, 2019 · 11 comments
Assignees
Labels
Playground Issues that affect the Playground

Comments

@saschanaz
Copy link

TypeScript Version: Playground

Search Terms: playground es2017

Code

Object.entries({}) // Property 'entries' does not exist on type 'ObjectConstructor'.

Expected behavior: It should get no error.

Actual behavior: It does get one.

Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=18&pln=1&pc=1#code/PIIwVgpgxgLgdBAdjATgSwgZwBQG8C+AlEA

Related Issues:

Couldn't find a relevant place to post an issue. @orta, is it being maintained on https://github.com/orta/typescript-play ?

@jcalz
Copy link

jcalz commented Oct 9, 2019

Playground issues are found at microsoft/TypeScript-Website (maybe the new issue template here should be updated to indicate that?)

@saschanaz
Copy link
Author

Thanks! Could someone transfer this to there? 🙏

@orta orta transferred this issue from microsoft/TypeScript Oct 10, 2019
@orta
Copy link
Contributor

orta commented Oct 10, 2019

I think this is about the default lib.d.ts which comes with monaco-typescript

As right now there isn't a way to configure your lib options inside the playground

@mikeaustin
Copy link

If someone is exploring the use of TypeScript, this isn't good. "Wow, TS doesn't even support Object.values()". I spent a few minutes toying with the target, Googling, then finally found this thread. I could see if this was a third party site, but this is the official language site. Kudos to the language.

@orta
Copy link
Contributor

orta commented Dec 16, 2019

Limited time and limited resources, @mikeaustin - you're welcome to take a look at it before I get back to it though?

@mikeaustin
Copy link

I can look into it (clone repo, look around), but I probably don't have enough context to work on it. I'll ask questions as they come up.

@David-Else
Copy link

David-Else commented Feb 10, 2020

@orta Please fix this. I can't ask for help with half my issues on forums as I can't provide a working example using the playground.

It does not work on v1 playground, and seemingly not on v2. I tried the 'export as markdown' option.

At the moment the playground is broken for modern JS syntax. Object.entries is in common use now. Thanks!

TypeScript Version: 3.8.0-beta

Actual behavior:
Property 'entries' does not exist on type 'ObjectConstructor'.

Related Issues:

Code

const rulesToAdd = {
  '@typescript-eslint/no-floating-promises': 'error',
  complexity: ['error', 10],
  'max-lines-per-function': [
    'error',
    {
      max: 50,
      skipBlankLines: true,
      skipComments: true,
      IIFEs: true
    }
  ],
  'max-params': ['error', 3]
};


const removedRuleNames = ['example']


export function outputToConsole(
  removedRules: string[],
  rulesAdded: string[]
): void {
  console.log(``);
}

outputToConsole(removedRuleNames, Object.entries(rulesToAdd));
Output
const rulesToAdd = {
    '@typescript-eslint/no-floating-promises': 'error',
    complexity: ['error', 10],
    'max-lines-per-function': [
        'error',
        {
            max: 50,
            skipBlankLines: true,
            skipComments: true,
            IIFEs: true
        }
    ],
    'max-params': ['error', 3]
};
const removedRuleNames = ['example'];
export function outputToConsole(removedRules, rulesAdded) {
    console.log(``);
}
outputToConsole(removedRuleNames, Object.entries(rulesToAdd));
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

@orta
Copy link
Contributor

orta commented Mar 23, 2020

Making sure this is linked to #7

The latest Monaco's now ship with ES2015

@orta
Copy link
Contributor

orta commented Jun 12, 2020

@RyanCavanaugh brought up the idea that maybe the playground should just ship with ESNext's bundled dts instead which is probably the right solution

@devuxer
Copy link

devuxer commented Jul 31, 2020

@orta, What about the idea of exposing the "lib" compiler option, or is that something the Monaco editor is unable to support?

@orta
Copy link
Contributor

orta commented Jul 31, 2020

This should probably be closed now that microsoft/monaco-typescript#64 exists, once this is in released built then I was planning on adding a lib option

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

6 participants