I want to import a node module with @import, but it seems visual studio code is not getting it. Or am I doing it wrong?
1) Take VSCode 2) Right click on the file in left pane 3) Click "Reveal in explorer" from context menu 4) Right click on the file -> Select "Open with" -> Select "Choose another program" 5) Check box "Always use this app to open . js file" 6) Click "More apps" -> "Look for another app in PC" 7) Navigate to node.
You'll need to open a new terminal (command prompt) for the node and npm command-line tools to be on your PATH. To test that you have Node. js installed correctly on your computer, open a new terminal and type node --version and you should see the current Node. js version installed.
Personally I would suggest TypeScript over JSDoc.
Nevertheless, try something like this? (there is no @import
tag in JSDoc).
// path/to/UiStore.js
/**
* @typedef UiStore
* @type {object}
* @property {string} foo - description for foo
* @property {string} bar - description for bar
*/
// path/to/another.js
/** @typedef {import("path/to/UiStore").UiStore} UiStore */
/** @type {UiStore} */
const uiStore = {
foo: 'hello',
bar: 'world',
};
With mobx-state-tree it works like this:
In file UiStore.js:
export const UiStoreType = UiStore.Type
and then in path/to/another.js
/**
* @typedef Props
* @prop { import("../stores/UiStore").UiStoreType } uiStore
* @prop { import("../stores/DbStore").DbStoreType } dbStore
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With