Skip to content

Allow compile-time computable expressions to initialize ambient consts #6804

Closed as not planned

Description

To support #6678, allow const declarations in ambient contexts to have compile-time computable initializers:

// foo.d.ts
const x = 'hello'; // OK
const y = 'hello ' + 'world' // OK
const z = 'hello'.substr(3); // Error

const a = 10; // OK
const b = 10 + 10; // OK
// Rest of rules follow from 'const enum' rules

const m = true; // OK
const n = false; // OK

Activity

  1. added
    Suggestion
    Effort: Moderate
    on Feb 1, 2016
  2. added this to the milestone on Feb 1, 2016
  3. added
    Declined
    on Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedEffort: ModerateSuggestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions