Skip to content

Function Generic is unknown if argument has NoInfer<Generic> but returns the GenericΒ #60922

@JeanMeche

Description

@JeanMeche

πŸ”Ž Search Terms

  • Generic
  • NoInfer
  • Unknown

πŸ•— Version & Regression Information

Still the case in the latest 5.7.2.

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/KYDwDg9gTgLgBAE2AYwDYEMrDgMwK4B2yMAlhAXKiQQNbAIDKJA5geqgDwMA0cAIgD4AFBDClyAZwBccAN4AoOErgSIeKMmAyhASjgBeAXAYBuRcuQQAtmDwx04gttXrNMgHIQAkgRzAoHIJ6hvxmAL46Mnxm8pYEEvASLGyoBpTUdIzJ7EIKyipqGlpwugZGAMzc5kqWNnYOZE4lEsEVcPIR8vJAA

πŸ’» Code

export declare function linkedSignal<S, D>(options: {
    source: () => S;
    computation: (source: NoInfer<D>) => D;
}): D;

const signal = linkedSignal({
    source: () => 3,
    computation: (s) => 3 
})

πŸ™ Actual behavior

signal is unknown

πŸ™‚ Expected behavior

signal is number

Additional information about the issue

I wasn't sure, but it could be a duplicate of #60544.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions