Search code examples
reactjstypescriptvisual-studio-codetslintmacos-catalina

TSLint and VSCode Issues: All destructured elements are unused


Error 1:

Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead. (no-angle-bracket-type-assertion)tslint(1)
This assertion is unnecessary since it does not change the type of the expression. (no-unnecessary-type-assertion)tslint(1)
'SchemaForm' refers to a value, but is being used as a type here.ts(2749)

Error 2:

All destructured elements are unused.

Error 3

Cannot find name 'container'.

enter image description here

enter image description here

What settings gone missing?

VSCode: Latest Version OS: Mac Catalina 10.15.3


Solution

  • JSX syntax is only valid in a .tsx file. Since you are in a .ts file, typescript will try to interpret the <> as a type assertion not a JSX tag, and parsing goes bad from there. Change the extension and it should work