Object is not generic (google-maps-react) - node.js

Just added google-maps-react along with #types/googlemaps to my project. Now when I attempt to bundle the project I get the below error.
../../node_modules/google-maps-react/index.d.ts:29:14 - error TS2315: Type 'Object' is not generic.
29 type Style = Object<string, string | number | boolean>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What exactly is causing this?

You need to add types for google-maps-react
npm install #types/google-maps-react

Related

TypeScript NodeJs mongoose-paginate-v2 Impossible build project

I'm trying to setup mongoose-paginate-v2 in my project but there is no way, I'm trying to build my code but I get these three errors.
Did you have any idea why?
Thanks
node_modules/#types/mongoose-paginate-v2/index.d.ts:34:21 - error TS2304: Cannot find name 'CollationOptions'.
34 collation?: CollationOptions | undefined;
~~~~~~~~~~~~~~~~
node_modules/#types/mongoose-paginate-v2/index.d.ts:45:19 - error TS2304: Cannot find name 'QueryFindOptions'.
45 options?: QueryFindOptions | undefined;
~~~~~~~~~~~~~~~~
src/models/book.model.ts:150:10 - error TS2339: Property 'paginate' does not exist on type 'Model<any, any, any>'.
150 this.paginate(query, options, function (err: any, result: any) {
~~~~~~~~
My Package.json about
"mongoose-paginate-v2": "^1.3.9",
"#types/mongoose-paginate-v2": "^1.3.9",
Lets assume someone have added dependencies of mongoose in package.json and prefix on version is like "^7.2.4"
It is not causing you any issue or error for now but as time goes and versioning of mongoose changes.
Try to use "~7.2.4" instead of "^7.2.4"
~version “Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.

Lit-Element import statement with unpkg

I have some projects with Lit-Element and all was fine till today. I had the usual import statement .
import {LitElement, html,css,} from "https://unpkg.com/lit-element#latest/lit-element.js?module";
Well I also have the option to install the library via npm but I want it to be the way it was.
Any suggestions what is wrong or how to fix it?
BTW the error in the browser:
Cannot generate module for lit-element#3.0.0-pre.3/lit-element.js
SyntaxError: unknown: Support for the experimental syntax 'nullishCoalescingOperator' isn't currently enabled (14:54):
12 | * subject to an additional IP rights grant found at
13 | * http://polymer.github.io/PATENTS.txt
14 | */var s;const i=t;((s=globalThis).litElementVersions??(s.litElementVersions=[])).push("3.0.0-pre.3");class o extends t{constructor(){super(...arguments),this.I={host:this},this.Φo=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.I).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const r=this.render();super.update(t),this.Φo=e(r,this.renderRoot,this.I)}connectedCallback(){super.connectedCallback(),this.Φo?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.Φo?.setConnected(!1)}render(){return r}}o.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:o}),globalThis.litElementPlatformSupport?.({LitElement:o});const l={O:(t,e,r)=>{t.O(e,r)},P:t=>t.P};export{o as LitElement,i as UpdatingElement,l as _Φ};
| ^
15 |
16 |
Add #babel/plugin-proposal-nullish-coalescing-operator (https://git.io/vb4Se) to the 'plugins' section of your Babel config to enable transformation.
undefined

Stories not rendering in 6.1.15 version of storybook

My main.js file:
Its not rendering stories inside Header.stories.js
Even I have explicitly included Header.stories.js but still the same issue, it's not being rendered.
Please see if anyone could help me with this as I am really stuck on this issue.
PS: Use following repo to reproduce the issue or to see the implementation!
click here to see the repo
You have this error in the console :
WARNING in ./src/components/Header.stories.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Storybook_demo/my_storybook/src/components/Header.stories.js: Const declarations require an initialization value (16:20)
14 | }
15 |
> 16 | export const Primary ()=>(<Header >'hii'</Header>);
| ^
I can see the =sign in your file, I honestly don't know why it doesn't work. It's look like a bug in a babel parser ?
However, you can make it work with juste a space between Primary and =:
export const Primary = ()=>(<Header >'hii'</Header>)

Windows 10 failure to compile with Node and React - syntax errors?

I've been trying to start up a React project but can't avoid the following syntax error message. I've tried Yarn only to run into more errors (that would be for another post). My coworkers have no trouble running this on their Macs, so I'm wondering if it's a Windows specific issue? Totally lost on this one:
./src/ducks/auth/index.js
Syntax error: C:/Users/user/code/project/src/ducks/auth/index.js: Unexpected
token, expected ; (5:20)
3 | export * from './constants';
4 |
> 5 | export default from './reducer';
| ^
6 |
7 | export * from './selectors';
Are you importing or exporting? Your syntax looks half and half right now. If you are exporting:
export default <name of function>
if you are importing:
import <name of default function> from './reducer
edit: Now that I look at it, you're obviously importing. When importing, you have to state the exact name of what you exported. There is no keyword default when importing. Also, you need to use import, not export.

javascript error when performing npm start in react-virtualized

I am trying to test react-virtualized.I used download-zip files.
When I run npm start in react-virtualized-master,
it doesn't render anything with below error.
Can anyone help to fix this bug?
React Error:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `Application`.
at invariant (invariant.js:44)
at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (instantiateReactComponent.js:86)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:388)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:262)
at Object.mountComponent (ReactReconciler.js:47)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:397)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:262)
at Object.mountComponent (ReactReconciler.js:47)
at mountComponentIntoNode (ReactMount.js:105)
at ReactReconcileTransaction.perform (Transaction.js:138)
I don't know what "react-virtualized-master" is. Are you talking about the master branch of the react-virtualized git repository?
My guess from the error message you copied was that the wrong version of React was installed (< 15.3) so it's unable to resolve PureComponent. This should not be the case if you're running the react-virtualized repo though as 16.0 alpha should be used.
Probably need more information to help with this to be honest.

Resources