aleph.js icon indicating copy to clipboard operation
aleph.js copied to clipboard

Enable type checking

Open TjeuKayim opened this issue 4 years ago • 3 comments
trafficstars

If the ts or tsx source code contains type errors, they are ignored by aleph dev and aleph build.

Steps to reproduce

Create this about.tsx page that assigns a number to a string type:

import React from 'react'
const x: string = 123
export default function About() {
  return <h1>Test {x}</h1>
}

Run aleph build. I expected the build to fail, but it only logged INFO Done in 884ms

Do I have to run a separate command for type checking?

At least the integration with Visual Studio Code works great, as it reports the problem Type 'number' is not assignable to type 'string'. (deno-ts)

Version

aleph.js v0.3.0-beta.10
deno 1.13.2 (release, x86_64-unknown-linux-gnu)
v8 9.3.345.11
typescript 4.3.5

TjeuKayim avatar Sep 04 '21 07:09 TjeuKayim

We are using swc to transpile code to resolve jsx/import-maps..., that just strips the types, but seems it will support type-check in the future, please check https://github.com/swc-project/swc/issues/571

ije avatar Sep 04 '21 11:09 ije

traspiling is different from typechecking. swc works correctly when it just strips typescript code, because that's how it works. Babel typescript works the same way. The only way to integrate typechecking is through tsc provided by typescript

floydjones1 avatar Sep 06 '21 14:09 floydjones1

This is very important. What's the point of using TypeScript if there's no type checking? 🤦

JoshuaWise avatar Oct 22 '21 18:10 JoshuaWise