Go for it. The class implementation in TypeScript is actually valid ES6. All TypeScript adds are annotations.
-
-
Replying to @mcclure111 @allafarce
Here's my "fork me" TypeScript+React web project based on the official TypeScript tutorial if you want it btwhttps://github.com/mcclure/ts-hello …
1 reply 0 retweets 4 likes -
-
Replying to @allafarce
Oh, and here's a version of this that uses libp2p— using libp2p is *not* useful to you, but it demonstrates using useState/useEffect, and the "declare let require:any" trick https://github.com/mcclure/ts-hello/blob/libp2p-preact/src/index.tsx …
1 reply 0 retweets 1 like -
Replying to @mcclure111 @allafarce
(If you have node libraries with TSDs you can use import, but if you have untyped node libraries you can't, but! you CAN create a require function with "declare let require:any" and then you can require any lib and get an untyped library object.)
1 reply 0 retweets 0 likes -
Replying to @mcclure111 @allafarce
[[ This is the way I do it and there may be a simpler way. Javascript currently has between two and three entirely unrelated ways of importing symbols from one file into another :( ]]
1 reply 0 retweets 0 likes -
Replying to @mcclure111
Yeah at this point I get lost! It's wild to see how quickly norms change in JS. Often feels to me like a good case study in the tyranny of flexibility.
1 reply 0 retweets 0 likes -
Replying to @allafarce
Indeed. Anyway if you choose to use react/preact, at some point you'll go "wait… once i've rendered the content to the DOM, how do I change it?" and the answer will be "use useState/useEffect" and it may be helpful to have some sample code on that
1 reply 0 retweets 1 like -
Replying to @mcclure111 @allafarce
(You could also choose not to use React/Preact, but I recommend doing so if your'e using TypeScript, because *typechecked HTML!* You write html and the typechecker tells you if there's errors! That is so cool!)
1 reply 0 retweets 1 like -
Note that LitElement is also TS-hinted.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.