Skip to content

Template string type infers error when string intersect with object type #48034

Closed
@XGHeaven

Description

@XGHeaven

Bug Report

πŸ”Ž Search Terms

Template string, Intersection type

πŸ•— Version & Regression Information

4.5.4

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const a = 'a'

type A = typeof a

type Mix = A & {foo: string}

type Origin1 = `${A}` // type is 'a'
type Origin2 = `${Mix}` // type is string

πŸ™ Actual behavior

Origin1 is 'a' and Origin2 is string

πŸ™‚ Expected behavior

Origin1 and Origin2 both are 'a'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @RyanCavanaugh@XGHeaven

      Issue actions

        Template string type infers error when string intersect with object type Β· Issue #48034 Β· microsoft/TypeScript