microsoft / microsoft/TypeScript

Bloomberg feedback for 5.8

Open
#61,226 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Discussion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

We evaluated the 5.8 beta and RC releases and 5.8 seems to be a low impact release for us.

We are excited to adopt the new flag --erasableSyntaxOnly for the improved Editor experience for features we already avoid. A significant number of our projects already comply with the corresponding rules due to custom error checks that will happily become redundant. We remain interested in gaining the ability to use first-class enums that comply with the TS=JS+types model. For example via the erasable as enum syntax proposal.

# Change Affects Release notes Packages affected
1 Computed properties with a non literal type now appear in declarations Declaration Emit Yes >1%
2 Better type checking of conditional expressions Type Checking No Yes ~1-2%
Computed properties with a non literal type now appear in declarations

Some declaration files changed and now preserve computed properties where index signatures would previously be created. This is an expected change and part of ongoing Isolated Declarations work.

// index.ts
export let foo = "x"
export class Bar {
    [foo]: string
}

// index.d.ts
export declare let foo: string;
export declare class Bar {
    // in 5.8
    [foo]: string;
    // in 5.7
    [x: string]: string;
}
Better checking in conditional expressions

We observed roughly a dozen new compile errors relating to improved conditional return checking.

While not directly announced the change seems related to Checked Returns for Conditional and Indexed Access Types

In TypeScript 5.7 and before, if a branch of a conditional expression returned any we would not get an error if we returned the wrong type on the other branch. Now we do, at least if the expression is in the return of a function:

declare const data: number | string | undefined;
const  result = (): number =>
    typeof data === 'string'
        ? null as any
        : data; // Error now


const  result2: number =  
    typeof data === 'string'
        ? null as any
        : data; // Still not an error ? 😕

Link

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the conditional-expression example in the linked TypeScript Playground using 5.7.3 and 5.8, then compare the reported declaration emit example across versions. The issue documents observed behavior but does not name a source file, test, or specific desired change, so completion would require maintainer guidance on whether either behavior is incorrect.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.