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

Design Meeting Notes, 4/24/2020 #38168

Closed
DanielRosenwasser opened this issue Apr 24, 2020 · 0 comments
Closed

Design Meeting Notes, 4/24/2020 #38168

DanielRosenwasser opened this issue Apr 24, 2020 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 24, 2020

Unexpected Breaking Changes

Deletes on Non-Optional Properties

#13783

Intersections narrowed to never with in

#38162

type MaybeFoo = {
    bar: string;
    foo?: number;
};
type AlwaysFoo = {
    foo: number | undefined;
    always: string;
};

declare const f: AlwaysFoo & MaybeFoo;
if ("foo" in f) {
    f.bar;
} else {
    // 3.8.3: f: AlwaysFoo & MaybeFoo
    // 3.9: 'f' is 'never'
    f.bar;
}
  • But that's the right behavior - similar to

    type AlwaysFoo = {
        foo: number | undefined;
        bar: string;
        always: string;
    };
    
    declare const f: AlwaysFoo;
  • Users were feature testing for a value on globalThis, but now have no clean way to do it.

  • Conclusion: If we can special-case for globalThis, let's do it. If we can't get it in by end-of-day, back it out prior to 3.9, add it to 4.0.

deleteCount Optionality in splice

#32638

  • Seems like this breaks stuff with .apply and .bind
  • Wasn't an "unexpected" break in the sense that it came in post-beta
  • This is technically correct, but even IE9 - IE11 has the "right" behavior of making things optional.
    • ES5.5 differences?
  • Seems like it's not worth the overhead and breaks.
  • Conclusion: revert before 3.9

export = and Declarations Types

#37964

  • Module augmentations occur before the calculation of the global Object type, global namespaces, etc.

  • Currently, code that does this crashes, but what should we do when you write this?

    import {toString} from "./foo";
    • This is a CJS-oriented feature, when you import from a CJS export = module.
    • We're "crossing the streams" - if you live in ES module land, everything's good. In this case, TypeScript gets to say "this shouldn't work".
  • What's this break?

    • Have to figure it out.
  • Also have to figure out other features that are impacted here.

  • Conclusion: need to issue an error - the circularity has to end somewhere.

JSX Factory Updates

#34547 (comment)

  • What about dev-mode paths?
  • What about the dev-mode line number/character offset.
  • There's a lot of details to think about - so there's a question about how configurable it needs to be, how we want to bless the workflow.
  • It's already implemented in Babel, but we need to understand what users are going to be using.

Control Flow for Constructor-Initialized Properties

#37920

  • We're going to enable this for all JS users, regardless of settings.
  • What about TS users? Only get this under noImplicitAny?
    • Feels bad to say no, but it breaks stuff!
    • We pamper you in JS mode, give you the special strict-mode club in TypeScript, but you're on your own when strict mode is off.
      • Always had this position, but it's the safest option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

2 participants