Skip to content

Design Meeting Notes, 3/31/2018 #23045

Closed
Closed
@mhegazy

Description

@mhegazy

global

Issue comes in the context of recognizing assignments to properties on this or window as global declarations.
We need way to refer to the global type, e.g. declare var window: Window & global; for DOM.
We have a precedence in the declare global { .. } support.

Some options:

// use new `import("module")` syntax with `global` instead
var window: Window & import(global);

// or no operand at all
var nan: typeof import().NAN;

// import.meta?
import.meta.global

// C++ anyone?
var x: global::NaN

// call it `global` or just `Global`
var x1: Global;
var x1: typeof Global;
var x1: Global.Array<number>

var x1: Global["NaN"];

var x1: typeof Global.NaN;

TC39 has been looking into a name for the value side of global https://github.com/tc39/proposal-global, the proposal is at stage 3.
The proposal has stalled on the choice of the variable name, global seems to be already in use.

@rbuckton contacted the proposal champion (@ljharb), and the proposal is still active. there are few names proposed at this point.

Conclusion, wait for TC39 to pick a name, and then use that in both type and value positions.

Resolving .json files

Allow infer types in expression type argument positions

  • PR: WIP - Allow infer types in expression type argument positions #22368

  • @weswigham, this is probably too much power, not clear what use cases require that.

  • the change is simple, relatively, thought

  • practically gives you associated types

  • We still need named type parameters, what to do when you wnat to specify the fifth type parameter and get everything inferred

  • we already have a proposal here, no need for another proposal

Array.isArray and ReadonlyArray

  • PR: Add support for ReadonlyArray to Array.isArray #22942
  • it is a breaking change, we are just trading one set of problems with another
  • should not change it
  • the core issue is that Array and ReadonlyArray are two distinct types. we need to think about a readonly modifier again

Variadic types

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions