Skip to content

Generic Conditional Type resolved to any when passed an error any typeΒ #59981

Closed as not planned
@Eazash

Description

@Eazash

πŸ”Ž Search Terms

"generic", "conditional type", "is any", "implicit any", "error", "module has no export member"

πŸ•— Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.4

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.5.4#code/C4TwDgpgBAkgzgQQHYgDwBUB8UC8UAMUEAHsBEgCZxQCMUAZFOlAPxTABOArtAFxQAzAIYAbOBABQEihADGIoR2gBbAPYUuI6ACI4q5RAC0ajVu1QA3gF8JoSLGVgRAS1nPgyELnbgIqgVDOjqocwAAUuvpGJpoQ2gCUAHQywprAUnbQAEoQcGne8J6oMI4ubh4omBIA9NVQ9Q0AeiwZvlAAosSQsmQUOXkiwAWIKKhClTV19c1AA

πŸ’» Code

type IsAny<T> = 0 extends 1 & T ? true : false

declare module "some-module" {}
type ImplicitAny = typeof import("some-module").default

type Result = IsAny<ImplicitAny> // any

type ExpectedResult = IsAny<any> // true
type ExpectedResult2 = IsAny<{}> // false

πŸ™ Actual behavior

The conditional type resolves to any

πŸ™‚ Expected behavior

The conditional type should resolve to either TrueType or FalseType. In this specific example, it should resolve to true

Additional information about the issue

While I was unable to use every-ts, after manually bisecting I've foudn that the first release with this buggy behaviour is 5.5.0-dev.20240524

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions