TypeScript type checking not performed properly? #944
-
| 
         Starting from the template generated by  So, is there something I am missing here? To me the entire point of TypeScript is to be able to check things before the code runs and crashes (or otherwise misbehaves), and I am also coming from  Also, I saw a comment on another discussion saying that WMR uses Sucrase to transpile TypeScript, but then looking at Sucrase's readme it states (emphasis added by me) "Compiles TypeScript code to JavaScript, removing type annotations and handling features like enums. Does not check types.", is that comment still accurate?  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| 
         Indeed, this behavior is correct; use  Most modern build tools no longer support type checking as it's egregiously slow. It's better to leave that up to the editor or a type checking script instead. 
 This is super easy to do:         "scripts": {
		"start": "wmr",
-		"build": "wmr build --prerender",
+		"build": "tsc && wmr build --prerender",
		"serve": "wmr serve"
	}, | 
  
Beta Was this translation helpful? Give feedback.
Indeed, this behavior is correct; use
tscinstead to check types.Most modern build tools no longer support type checking as it's egregiously slow. It's better to leave that up to the editor or a type checking script instead.
This is super easy to do:
"scripts": { "start": "wmr", - "build": "wmr build --prerender", + "build": "tsc && wmr build --prerender", "serve": "wmr serve" },