cube-js / cube

📊 Cube — The Semantic Layer for Building Data Applications
https://cube.dev
Other
17.85k stars 1.77k forks source link

Moving to TypeScript #1091

Open ovr opened 4 years ago

ovr commented 4 years ago

Hey!

In 2020 TypeScript started to be a standard (exclude flow in fb internals 😄 ) for every project, It helps use to:

Before We start

  1. Performance should not be affected
  2. BC should be done as deprecated notice, next code removal
  3. Dont break exists typings if they provided (merge to interfaces?)

High level iteration plan:

Scope

Due to the fact, that cube.js is not a small project, it's expected to have a plan, How to move it to TypeScript.

It's not possible to move module with dependency on another module that doesn't have typings. It's why dependency tree is useful to detect "core" modules.

Guide

  1. Generate declarations for every package automatically (1-2 base packages, it's needed to write driver on TypeScript)
  2. Introduce first driver fully on top of TS
  3. Move packages from 1st step to TS
  4. Move all packages to TS

Scope

Isolated packages

Frontend packages

Backend packages (base only)

Drivers

Non code

Thanks

vincentwinkel commented 2 years ago

Hello, Small issue here when I build using tsc:

Screenshot 2021-10-26 at 09 37 46
    "@typescript-eslint/eslint-plugin": "^3.8.0",
    "@typescript-eslint/parser": "^3.8.0",
    "cross-env": "^7.0.2",
    "ts-node-dev": "^1.1.8",
    "tsconfig-paths": "^3.9.0",
    "type-graphql": "^1.0.0-rc.3",
    "typescript": "^3.9.7",
    "@cubejs-backend/postgres-driver": "^0.28.46",
    "@cubejs-backend/server-core": "^0.28.46"
reify-thomas-smith commented 2 years ago

I've taken a few stabs at converting both cubejs-client-core and cubejs-client-react. This is what I've learned: