Category : intellisense

I’m maintaining an electron app using Typescript. I’m trying to implement absolute paths for imports in my project. I understand that the way you would normally resolve this would be to edit webpack config, but since I’m using react CRA, and ideally don’t want to "eject" and manage things myself just for this issue, I’ve ..

Read more

Small but annoying issue, im working with electron and react, and when I access the ‘fs’ module it works, but there’s no intellisense whatsoever. for example: import fs from ‘fs’ or const fs = require(‘fs’) will provide the proper methods and autocompletion, but: const electronFs = window.require(‘electron’).remote.require(‘fs’) will not. I know why it’s happening, but ..

Read more

I have a root component called ThemeProvider.js which enables any of its children (even html tag) to use some cssHelpers for styling; for example: <ThemeProvider> <div _padding=’sm’ _color=’priamry’ > some text </div> </ThemeProvider> Any depth of children can use them, and it works fine; The Challenge: Now we want to have autocomplete for these added ..

Read more

I have the following custom string method: /** * * @param {String} name * @param {String} as * @returns this * @example * ‘{example}’.replaceBracket(‘example’, ‘Hello!’) // Output: ‘Hello!’ */ String.prototype.replaceBracket = function(name, as) { return this.replace(`{${name}}`, as) } It works but no intellisense, and JSDOC example isn’t showing. Source: Ask Javascript..

Read more

My prefered file structure for react/react-native projects goes as follows. src screens components component1 component2 index.js assets package.json I like to export all components from index.js so after creating and exporting component1, component2 as default I import them into index.js then export from it with export {component1,component2}. After doing that I like to make the ..

Read more

In VSCode, when adding a prototype to an imported class, hovering over bar() just displays any. const { Class } = require(‘module.js’); Class.prototype.bar = function() {}; var foo = new Class(); foo.bar(); On the other hand, here it displays (method) Class.bar(): void class Class {}; /** * @name bar */ Class.prototype.bar = function() {}; var ..

Read more