Typescript not working in svelte files

My script tags all have a lang=“ts” attribute. However, I get error messages like “Type assertion expressions can only be used in TypeScript files.”

When I open this project in vs-code, there are no errors.

Any hints on what to try?

User error! Somehow Language Mode had gotten switched to HTML. Switching to Svelte fixed the problem.