Skip to content

Design Meeting Notes, 2026-06-23 #63674

Description

@DanielRosenwasser

isolatedDeclarations and Control Flow Analysis

microsoft/typescript-go#4367

  • Want to be able to infer types for trivial expressions in isolatedDeclarations in a function block.
    • Specifically in discussion is if there are no return statements.
  • But what happpens when you have a never-returning call? That can cause a never.
  • Feels like anything with multiple statements in the body is questionable.
  • We could make a special-case for () => {}.
    • Probably enough to just say "just write void".
  • Feels bad to say we can't come up with a type for () => {}
    • Why? Feels like it's not a big deal?
    • Well it's even more trivial than a single expression being returned.
    • Sure, but the reason we added trivial expression inference was because people often have bigger structures of objects that are nested. So the triviality was not really about writing small expressions.
  • One reason why we didn't do it (we think) is that we don't want to close the door to ourselves on how void vs. undefined is inferred for no-return-expression functions.

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