-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options
Description
π Search Terms
"string"
π Version & Regression Information
- This is an unexpected behavior
β― Playground Link
π» Code
// gives `true`, because `${string}${string}` type turns into string type but it shouldnt and should give `false`
type _ = string extends `${string}${string}` ? true : false;
// Similarly should be false because first ${string} gets the empty space only empty space, and there is nothing left to satify second ${string}
type __ = "" extends `${string}${string}` ? true : false;
π Actual behavior
`${string}${string}`
type turns into string
type.
π Expected behavior
`${string}${string}`
should stay as its.
Additional information about the issue
// gives `true`, because `${string}${string}` type turns into string type but it shouldnt and should give `false`
type _ = string extends `${string}${string}` ? true : false;
// Similarly should be false because first ${string} gets the empty space only empty space, and there is nothing left to satify second ${string}
type __ = "" extends `${string}${string}` ? true : false;
// What is correct
{
// works without error as expected because empty space at the start satisfies ${string}
const foo: `${string}@` = "@";
// gives error as expected because first ${string} already uses the empty space at the start
// and second one has no empty space to use
// so before @ it expects at least one other character
const bar: `${string}${string}@` = "@";
// so this works as expected
const baz: `${string}${string}@` = "a@";
}
// What is wrong
{
// should give error but doesnt because `${string}${string}` type turns into string type
// `${string}${string}` should stay as its and foo should expect its setter value to satisfy at least one character
const foo: `${string}${string}` = "";
}
Not sure if its a feature or a bug, but and its not consistent, and it looks like a bug, sound like a bug, acts like a bug.
Metadata
Metadata
Assignees
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options