jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration
https://razzlejs.org
MIT License
11.1k stars 868 forks source link

No type checking in server build #1797

Open swojdyga opened 2 years ago

swojdyga commented 2 years ago

🐛 Bug report

Current Behavior

No type checking in server build.

Expected behavior

With typescript plugin, code in server build should be type checking like client build.

Reproducible example

  1. npx create-razzle-app --example with-typescript-plugin with-typescript-plugin
  2. npm run start

Suggested solution(s)

I removed condition "opts.env.target === 'web'" from razzle-plugin-typescript/index.js:73 and type checking on server build works fine.

Additional context

Your environment

Software Version(s)
Razzle 4.2.13
Razzle Plugins 4.2.13
Node 14.17.4
Browser -
npm 6.14.14
Operating System -
TypeScript 4.5.4
React 17.0.2
fivethreeo commented 2 years ago

Mostly the same code is being typechecked, but could add a option to turn on for both

swojdyga commented 2 years ago

That's true, but on the other hand there can be a lot of unique code on server side, for example getting products - on client side getting products could be realized via API, but on server side could be realized via connecting to redis cache server (it's much faster).

I think better is get same errors two times than getting no errors.