#@babel/parser error on type assertion
4 messages · Page 1 of 1 (latest)
I've not seen that first format and don't think it's valid TypeScript. Did you perhaps mean this?
const obj: MyType = {
key: value
}
Hello Kyle, the first format is valid TypeScript (https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions) and an alternative to the as MyType syntax. Of course your example is the preferred option but I wanted to make an example for type assertion.
The language primitives.
Oh! Today I learned. 📚 Thanks for the link!
I noticed that it says it won't work in *.tsx files. Is that the case here?