Skip to content

Syntax suggestion: Ignore last void parameters #4260

Description

classX<T>{f(t: T){return{a: t};}}varx: X<number>;vart1=x.f(5);t1.a=5;// Should not error: t1 should have type {a: number}, instead has type {a: T}
varx2: X<void>;vart2a=x.f(void0);// It works but void 0 it's unnecessaryvart2b=x.f();// SUGGESTION: ignore syntax check of last argument if it's type is voidt2b.a=void0;// Should not error: t2 should have type {a: void}, instead has type {a: T}

test case: tests/cases/compiler/genericObjectLitReturnType.ts

maybe the solution is the same for #3356

Metadata

Metadata

Assignees

No one assigned

    Labels

    Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions