atk / solid-blocks

UI building blocks for SolidJS.
https://atk.github.io/solid-blocks/
81 stars 2 forks source link

remove typescript #7

Closed milahu closed 2 years ago

milahu commented 2 years ago

typescript is 90% pain and 10% profit ... can we please get rid off this hype? the only thing that does make sense are the *.d.ts declaration files

no need to merge this, i will just use my solid-blocks-vanillajs fork

npm i -D solid-blocks@git+https://github.com/milahu/solid-blocks-vanillajs.git
to convert tsx to jsx, i used `npx tsc -p tsconfig.json` with tsconfig.json ```json { "include": [ "./src" ], "compilerOptions": { "outDir": "./tsc-out", "target": "es2020", "module": "es2020", "strict": false, "esModuleInterop": true, "jsx": "preserve", "jsxImportSource": "solid-js", "moduleResolution": "node" } } ``` demo and docs will need some extra work
atk commented 2 years ago

I disagree.

Typescript can be really helpful on more complex projects - and you'll probably agree that a compliment library is something a bit more complex.

Also, maintaining the .d.ts without typescript is a lot more hassle than maintaining the whole library with typescript.

As an example, take chakra-ui - they originally maintained their type definitions separately and it simplified the maintenance when they finally switched to TypeScript.

jimmywarting commented 2 years ago

you can still generate d.ts file from vanilla javascript... And have type safety & IDE autocompletion with spotting error without typescript flavoured syntax... I'm with @milahu on this, 90% pain very little benefits

https://jimmywarting.github.io/you-might-not-need-typescript/

atk commented 2 years ago

I don't like the disconnect between the types and the code that this method requires. Also, I still don't see what is so painful about TypeScript.

milahu commented 2 years ago

still

no need to merge this

just for sake of completeness

nobody likes wasting time compiling stuff

https://jimmywarting.github.io/you-might-not-need-typescript/

cd $(mktemp -d)
npm init -y
time npm i git+https://github.com/atk/solid-blocks.git

# 100 seconds
cd $(mktemp -d)
npm init -y
time npm i solid-blocks@git+https://github.com/milahu/solid-blocks-vanillajs.git

# 4 seconds

... on my 2x2.4GHz cpu

atk commented 2 years ago

You're comparing apples and oranges, as your compilation doesn't do strict type checking at all, so you basically lose almost all the advantage from using typescript in the first place. Also, if you use vite during development, you'll hardly notice the compilation at all.

milahu commented 2 years ago

lets just say my solid-blocks-vanillajs repo is a workaround for #4