Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Use [[Set]] by default, add define keyword. (was: TypeScript class fields have [[Set]] semantics.) #248

Copy link
Copy link
@trusktr

Description

@trusktr
Issue body actions

Class-fields in TypeScript have [[Set]] semantics. Foresee code breaking when JavaScript projects convert to TypeScript (or vice versa), and the pain caused from hard-to-find bugs, because of JavaScript class-fields using [[Define]] semantics.

I know this has been discussed in other threads, but I thought I'd open an official issue for it.


EDIT: Why not add a define keyword:

class Foo {
  foo = 'foo' // uses [[Set]] semantics
  define bar = 'bar' // uses [[Define]] semantics
}

Honestly, it would make most people (talking about end users who develop products, not language designers or implementors) happy.

amio, Splaktar, hcwhan, nexussays, tam5 and 3 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.