Replies: 2 comments 7 replies
-
I prefer build-less setups // settings.json
{
// The 3 most important one:
// Enable semantic checking of JavaScript files.
// Existing jsconfig.json or tsconfig.json files override this setting.
"js/ts.implicitProjectConfig.checkJs": true,
// Enable suggestion to complete JSDoc comments.
"javascript.suggest.completeJSDocs": true,
// Preferred path ending with extension (good for ESM & cjs).
"javascript.preferences.importModuleSpecifierEnding": "js",
// Other suggestions useful stuff:
// Complete functions with their parameter signature.
"javascript.suggest.completeFunctionCalls": true,
// Enable auto import suggestions.
"javascript.suggest.autoImports": true
} I like vanilla JS + JSDoc cuz
I'm very much like the svelte creator Rich who now also prefer JSDoc over typescript. he decided to switch the entire v4 codebase back to vanilla js + jsdoc https://www.youtube.com/watch?v=MJHO6FSioPI&t=214s But sure, we could include a if we need complex types then we could always do a |
Beta Was this translation helpful? Give feedback.
-
I've been eyeing https://github.com/tc39/proposal-decorators and since it's already in TS, you can use it without another Babel toolchain step 😃 demo Something like a function eventHandlerIDLAttribute() {
// ...
}
class Thing extends EventTarget {
@eventHandlerIDLAttribute
onclick;
@eventHandlerIDLAttribute
accessor onerror;
} could be interesting... 🤔 This is something you can't really do nicely in plain JS 😅 |
Beta Was this translation helpful? Give feedback.
-
For packages that apply things globally, I like to use something like this to get accurate types:
I also think that TypeScript could come in handy with its less verbose type syntax since this package has a lot of un-inferrable types that need to be manually specified.
I understand if you want to stick with plain JavaScript, but I'd at least recommend using JSDoc +
tsc --allowJs --checkJs
to make sure that things are good type-wise. 😊Beta Was this translation helpful? Give feedback.
All reactions