Skip to content

--useDefineForClassFields should be default in tsc init #43167

Closed
@ljharb

Description

@ljharb

Suggestion

Using flags to maintain back compat is fine, but tsc init should ideally always match "what we would do by default if we didn't care about back compat". Hence, class fields should match the spec and use [[Define]] by default for all new projects.

See #12437 (comment).

🔍 Search Terms

class fields, useDefineForClassFields, tsc init, default
(i didn't search tho because a TS team member asked for a new issue)

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • [c] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions