TypeScript Version: 4.1.3
Search Terms: template literal types
type Pseudo = `&:${string}`
const AmIPseudo1: Pseudo = '&:test' // Passes as expected
const AmIPseudo: Pseudo = '&' // Fails as expected
type PseudoDeclaration = {
[key in Pseudo]: string
}
// No Errors
const test: PseudoDeclaration = {
'someKey' : 'someValue'
}
Expected behavior:
test should not be able to pass the type-checking as its key 'someKey' is not of type Pseudo.
Actual behavior:
test passes the type-checking.
TypeScript Version: 4.1.3
Search Terms: template literal types
Expected behavior:
testshould not be able to pass the type-checking as its key 'someKey' is not of typePseudo.Actual behavior:
testpasses the type-checking.