'error TS2300: Duplicate identifier 'DocumentQuery' from ts-mongoose and and mongoose - node.js

I am trying to run a local copy of a server I am working on with the following packages.
"dependencies": {
"#types/mongodb": "^4.0.7",
"cors": "^2.8.5",
"express": "^4.18.2",
"mongoose": "^5.10.19",
"nodemon": "^2.0.20",
"ts-mongoose": "0.0.24",
"typescript": "3.9.5"
}
However, when I try to run this very basic app I get the following error message.
node_modules/mongoose/index.d.ts:3033:8 - error TS2300: Duplicate identifier 'DocumentQuery'.
After a bit of googling, I /think/ the issue is that both mongoose and mongoose TS are declaring the same identifier. But I'm unsure how to fix it. I'm also unsure of what info needs to be included as well. The code for the app doesn't actually include DocumentQuery, so I find that confusing as well. What should be my next steps in terms of identify and solving the issue?
Here is a full copy of the error.
node_modules/mongoose/index.d.ts:3033:8 - error TS2300: Duplicate identifier 'DocumentQuery'.
3033 type DocumentQuery<ResultType, DocType extends Document, THelpers = {}> = Query<ResultType, DocType, THelpers>;
~~~~~~~~~~~~~
node_modules/ts-mongoose/plugin.d.ts:4:15
4 interface DocumentQuery<T, DocType extends Document, QueryHelpers = {}> extends mquery {
~~~~~~~~~~~~~
'DocumentQuery' was also declared here.
node_modules/ts-mongoose/plugin.d.ts:4:15 - error TS2300: Duplicate identifier 'DocumentQuery'.
4 interface DocumentQuery<T, DocType extends Document, QueryHelpers = {}> extends mquery {
~~~~~~~~~~~~~
node_modules/mongoose/index.d.ts:3033:8
3033 type DocumentQuery<ResultType, DocType extends Document, THelpers = {}> = Query<ResultType, DocType, THelpers>;
~~~~~~~~~~~~~
'DocumentQuery' was also declared here.
node_modules/ts-mongoose/plugin.d.ts:5:103 - error TS2344: Type 'T & Document<any, any, any>' does not satisfy the constraint 'Document<any, any, any>'.
The types of 'replaceOne(...).$where(...).and' are incompatible between these types.
Type '(array: _FilterQuery<T & Document<any, any, any>>[]) => Query<(T & Document<any, any, any>)[], T & Document<any, any, any>, {}, T & Document<...>>' is not assignable to type '(array: _FilterQuery<Document<any, any, any>>[]) => Query<Document<any, any, any>[], Document<any, any, any>, {}, Document<any, any, any>>'.
Types of parameters 'array' and 'array' are incompatible.
Type '_FilterQuery<Document<any, any, any>>[]' is not assignable to type '_FilterQuery<T & Document<any, any, any>>[]'.
Type '_FilterQuery<Document<any, any, any>>' is not assignable to type '_FilterQuery<T & Document<any, any, any>>'.
Type '_FilterQuery<Document<any, any, any>>' is not assignable to type '{ [P in keyof (T & Document<any, any, any>)]?: Condition<[Extract<(T & Document<any, any, any>)[P], ObjectId>] extends [never] ? (T & Document<any, any, any>)[P] : string | (T & Document<...>)[P]>; }'.
5 populateTs<P extends keyof MaybeItem<NonNullable<T>>>(prop: P): DocumentQuery<Populate<T, P>, T & Document> & QueryHelpers;
~~~~~~~~~~~~
node_modules/ts-mongoose/types/extract.d.ts:10:136 - error TS2344: Type 'R & SubDocument' does not satisfy the constraint 'SubDocument'.
Types of property 'overwrite' are incompatible.
Type '(obj: DocumentDefinition<R & SubDocument>) => R & SubDocument' is not assignable to type '(obj: DocumentDefinition<SubDocument>) => SubDocument'.
Types of parameters 'obj' and 'obj' are incompatible.
Type 'DocumentDefinition<SubDocument>' is not assignable to type 'DocumentDefinition<R & SubDocument>'.
10 declare type DeepExtractProps<T> = T extends ((infer R & SubDocument) | (infer R & SubDocumentNoId)) ? R : T extends (SubDocumentArray<infer R & SubDocument> | SubDocumentArrayNoId<infer R & SubDocumentNoId>) ? Array<{
~~~~~~~~~~~~~~~~~~~~~
node_modules/ts-mongoose/types/singleType.d.ts:21:173 - error TS2344: Type 'Extract<T> & SubDocument' does not satisfy the constraint 'SubDocument'.
Types of property 'overwrite' are incompatible.
Type '(obj: DocumentDefinition<Extract<T> & SubDocument>) => Extract<T> & SubDocument' is not assignable to type '(obj: DocumentDefinition<SubDocument>) => SubDocument'.
Types of parameters 'obj' and 'obj' are incompatible.
Type 'DocumentDefinition<SubDocument>' is not assignable to type 'DocumentDefinition<Extract<T> & SubDocument>'.
21 export declare type ArrayOfElements<T> = IsSchemaType<T, ExtractOptions<T> extends OptionIdDisabled ? SubDocumentArrayNoId<Extract<T> & SubDocumentNoId> : SubDocumentArray<Extract<T> & SubDocument>, Array<T>>;

Related

GraphQL build issue: Interface 'ExecutionResult<TData>' incorrectly extends interface 'ExecutionResult'

I am building a GraphQL lambda server with typescript#4.9.4 graphql#15.8.0 apollo-server-lambda#2.19.0, but got the following error:
node_modules/apollo-link/lib/types.d.ts(5,18): error TS2430: Interface 'ExecutionResult<TData>' incorrectly extends interface 'ExecutionResult<{ [key: string]: any; }, { [key: string]: any; }>'
Types of property 'data' are incompatible.
Type 'TData | null | undefined' is not assignable to type '{ [key: string]: any; } | null | undefined'.
Type 'TData' is not assignable to type '{ [key: string]: any; } | null | undefined'.
Type 'TData' is not assignable to type '{ [key: string]: any; }'.
Any suggestions on how to fix this issue?
Have tried to install different graphql versions ^14.0.0 ^16.0.0? They did not work.
package.json dependencies:
"#aws-sdk/client-kms": "^3.16.0",
"apollo-server-lambda": "2.19.0",
"aws-embedded-metrics": "^2.0.4",
"axios": "^0.24.0",
"axios-retry": "^3.2.5",
"graphql": "^15.5.0",

Error when trying to upload G-Cloud-Function

i got a problem when uploading my Cloud-Functions to Firebase.
Using Typescript i need to do some XML-Parsing and therefore i need a package called xmldom-ts, but it shows me this abstract error:
tsc
node_modules/typescript/lib/lib.dom.d.ts:6059:11 - error TS2320: Interface 'HTMLAnchorElement' cannot simultaneously extend types 'HTMLElement' and 'HTMLHyperlinkElementUtils'.
Named property 'toString' of types 'HTMLElement' and 'HTMLHyperlinkElementUtils' are not identical.
6059 interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils {
~~~~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:6168:11 - error TS2320: Interface 'HTMLAreaElement' cannot simultaneously extend types 'HTMLElement' and 'HTMLHyperlinkElementUtils'.
Named property 'toString' of types 'HTMLElement' and 'HTMLHyperlinkElementUtils' are not identical.
6168 interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils {
~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:24:5 - error TS2416: Property 'createElement' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(tagName: string) => ElementImpl' is not assignable to type '(_tagName: string) => HTMLElement'.
Property 'autofocus' is missing in type 'ElementImpl' but required in type 'HTMLElement'.
24 createElement(tagName: string): ElementImpl;
~~~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:7989:5
7989 autofocus: boolean;
~~~~~~~~~
'autofocus' is declared here.
node_modules/xmldom-ts/dist/types/document.d.ts:25:5 - error TS2416: Property 'createDocumentFragment' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '() => DocumentFragmentImpl' is not assignable to type '() => DocumentFragment'.
Call signature return types 'DocumentFragmentImpl' and 'DocumentFragment' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
25 createDocumentFragment(): DocumentFragmentImpl;
~~~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:26:5 - error TS2416: Property 'createTextNode' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(data: string) => TextImpl' is not assignable to type '(_data: string) => Text'.
Call signature return types 'TextImpl' and 'Text' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
26 createTextNode(data: string): TextImpl;
~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:27:5 - error TS2416: Property 'createComment' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(data: string) => CommentImpl' is not assignable to type '(_data: string) => Comment'.
Call signature return types 'CommentImpl' and 'Comment' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
27 createComment(data: string): CommentImpl;
~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:28:5 - error TS2416: Property 'createCDATASection' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(data: string) => CDATASectionImpl' is not assignable to type '(_data: string) => CDATASection'.
Call signature return types 'CDATASectionImpl' and 'CDATASection' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
28 createCDATASection(data: string): CDATASectionImpl;
~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:29:5 - error TS2416: Property 'createProcessingInstruction' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(target: string, data: string) => ProcessingInstructionImpl' is not assignable to type '(_target: string, _data: string) => ProcessingInstruction'.
Property 'sheet' is missing in type 'ProcessingInstructionImpl' but required in type 'ProcessingInstruction'.
29 createProcessingInstruction(target: string, data: string): ProcessingInstructionImpl;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:9677:14
9677 readonly sheet: CSSStyleSheet | null;
~~~~~
'sheet' is declared here.
node_modules/xmldom-ts/dist/types/document.d.ts:30:5 - error TS2416: Property 'createAttribute' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(name: string) => AttrImpl' is not assignable to type '(_name: string) => Attr'.
Call signature return types 'AttrImpl' and 'Attr' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
30 createAttribute(name: string): AttrImpl;
~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:31:5 - error TS2416: Property 'createEntityReference' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(name: string) => EntityReferenceImpl' is not assignable to type '(_name: string) => Node'.
Call signature return types 'EntityReferenceImpl' and 'Node' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
31 createEntityReference(name: string): EntityReferenceImpl;
~~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/document.d.ts:33:5 - error TS2416: Property 'createAttributeNS' in type 'DocumentImpl' is not assignable to the same property in base type 'DummyDocument'.
Type '(namespaceURI: string, qualifiedName: string) => AttrImpl' is not assignable to type '(_namespaceURI: string, _qualifiedName: string) => Attr'.
Type 'AttrImpl' is not assignable to type 'Attr'.
33 createAttributeNS(namespaceURI: string, qualifiedName: string): AttrImpl;
~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dom-implementation.d.ts:12:5 - error TS2416: Property 'createDocument' in type 'DOMImplementationImpl' is not assignable to the same property in base type 'DummyDOMIMplementation'.
Type '(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null) => DocumentImpl' is not assignable to type '(_namespaceURI: string | null, _qualifiedName: string | null, _doctype: DocumentType | null) => Document'.
Call signature return types 'DocumentImpl' and 'Document' are incompatible.
The types of 'defaultView' are incompatible between these types.
Type 'Window | null' is not assignable to type '(Window & typeof globalThis) | null'.
Type 'Window' is not assignable to type 'Window & typeof globalThis'.
Type 'Window' is not assignable to type 'typeof globalThis'.
12 createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): DocumentImpl;
~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dom-implementation.d.ts:13:5 - error TS2416: Property 'createDocumentType' in type 'DOMImplementationImpl' is not assignable to the same property in base type 'DummyDOMIMplementation'.
Type '(qualifiedName: string, publicId: string, systemId: string) => DocumentTypeImpl' is not assignable to type '(_qualifiedName: string, _publicId: string, _systemId: string) => DocumentType'.
Call signature return types 'DocumentTypeImpl' and 'DocumentType' are incompatible.
The types of 'previousSibling' are incompatible between these types.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
13 createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentTypeImpl;
~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-attr.d.ts:3:31 - error TS2420: Class 'DummyAttr' incorrectly implements interface 'Attr'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare abstract class DummyAttr extends NodeImpl implements Attr {
~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-cdata-section.d.ts:3:22 - error TS2420: Class 'DummyCDATASection' incorrectly implements interface 'CDATASection'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyCDATASection extends CharacterDataImpl implements CDATASection {
~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-character-data.d.ts:3:31 - error TS2420: Class 'DummyCharacterData' incorrectly implements interface 'CharacterData'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare abstract class DummyCharacterData extends NodeImpl implements CharacterData {
~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-comment.d.ts:3:22 - error TS2420: Class 'DummyComment' incorrectly implements interface 'Comment'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyComment extends CharacterDataImpl implements Comment {
~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-document-fragment.d.ts:3:22 - error TS2420: Class 'DummyDocumentFragment' incorrectly implements interface 'DocumentFragment'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyDocumentFragment extends NodeImpl implements DocumentFragment {
~~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-document-type.d.ts:3:22 - error TS2420: Class 'DummyDocumentType' incorrectly implements interface 'DocumentType'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyDocumentType extends NodeImpl implements DocumentType {
~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-document.d.ts:126:14 - error TS2416: Property 'defaultView' in type 'DummyDocument' is not assignable to the same property in base type 'Document'.
Type 'Window | null' is not assignable to type '(Window & typeof globalThis) | null'.
Type 'Window' is not assignable to type 'Window & typeof globalThis'.
Type 'Window' is missing the following properties from type 'typeof globalThis': globalThis, eval, parseInt, parseFloat, and 721 more.
126 readonly defaultView: Window | null;
~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-document.d.ts:147:14 - error TS2416: Property 'onreadystatechange' in type 'DummyDocument' is not assignable to the same property in base type 'Document'.
Type '((this: Document, ev: ProgressEvent<EventTarget>) => any) | null' is not assignable to type '((this: Document, ev: Event) => any) | null'.
Type '(this: Document, ev: ProgressEvent<EventTarget>) => any' is not assignable to type '(this: Document, ev: Event) => any'.
Types of parameters 'ev' and 'ev' are incompatible.
Type 'Event' is missing the following properties from type 'ProgressEvent<EventTarget>': lengthComputable, loaded, total
147 readonly onreadystatechange: ((this: Document, ev: ProgressEvent) => any) | null;
~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-element.d.ts:148:5 - error TS2416: Property 'getBoundingClientRect' in type 'DummyElement' is not assignable to the same property in base type 'Element'.
Type '() => DOMRect | ClientRect' is not assignable to type '() => DOMRect'.
Type 'DOMRect | ClientRect' is not assignable to type 'DOMRect'.
Type 'ClientRect' is missing the following properties from type 'DOMRect': x, y, toJSON
148 getBoundingClientRect(): ClientRect | DOMRect;
~~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-element.d.ts:148:5 - error TS2416: Property 'getBoundingClientRect' in type 'DummyElement' is not assignable to the same property in base type 'HTMLElement'.
Type '() => DOMRect | ClientRect' is not assignable to type '() => DOMRect'.
148 getBoundingClientRect(): ClientRect | DOMRect;
~~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-element.d.ts:149:5 - error TS2416: Property 'getClientRects' in type 'DummyElement' is not assignable to the same property in base type 'Element'.
Type '() => ClientRectList | DOMRectList' is not assignable to type '() => DOMRectList'.
Type 'ClientRectList | DOMRectList' is not assignable to type 'DOMRectList'.
Type 'ClientRectList' is not assignable to type 'DOMRectList'.
The types returned by 'item(...)' are incompatible between these types.
Type 'ClientRect' is not assignable to type 'DOMRect'.
149 getClientRects(): ClientRectList | DOMRectList;
~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-element.d.ts:149:5 - error TS2416: Property 'getClientRects' in type 'DummyElement' is not assignable to the same property in base type 'HTMLElement'.
Type '() => ClientRectList | DOMRectList' is not assignable to type '() => DOMRectList'.
149 getClientRects(): ClientRectList | DOMRectList;
~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-entity-reference.d.ts:3:22 - error TS2420: Class 'DummyEntityReference' incorrectly implements interface 'Node'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyEntityReference extends NodeImpl implements EntityReference {
~~~~~~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-node.d.ts:8:14 - error TS2416: Property 'previousSibling' in type 'DummyNode' is not assignable to the same property in base type 'Node'.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is missing the following properties from type 'ChildNode': after, before, remove, replaceWith
8 abstract previousSibling: Node | null;
~~~~~~~~~~~~~~~
node_modules/xmldom-ts/dist/types/dummy/dummy-processing-instruction.d.ts:3:31 - error TS2420: Class 'DummyProcessingInstruction' incorrectly implements interface 'ProcessingInstruction'.
Property 'sheet' is missing in type 'DummyProcessingInstruction' but required in type 'ProcessingInstruction'.
3 export declare abstract class DummyProcessingInstruction extends CharacterDataImpl implements ProcessingInstruction {
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:9677:14
9677 readonly sheet: CSSStyleSheet | null;
~~~~~
'sheet' is declared here.
node_modules/xmldom-ts/dist/types/dummy/dummy-text.d.ts:3:22 - error TS2420: Class 'DummyText' incorrectly implements interface 'Text'.
Types of property 'previousSibling' are incompatible.
Type 'Node | null' is not assignable to type 'ChildNode | null'.
Type 'Node' is not assignable to type 'ChildNode'.
3 export declare class DummyText extends CharacterDataImpl implements Text {
~~~~~~~~~
Found 29 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions# build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions# build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Any idea why i get this error? My package.json:
"dependencies": {
"es6-promise-pool": "^2.5.0",
"firebase-admin": "^8.12.1",
"firebase-functions": "^3.7.0",
"stripe": "^8.67.0",
"xmldom-ts": "^0.3.1",
"xpath-ts": "^1.3.13"
},
npm tsc and vscode show no problems / warnings & i tried npm reinstall multiple times.
Removing xmldom-ts from packages solved the Problem
npm uninstall xmldom-ts

Trying to generate production version of Express with Typescript

I'm getting this error below when I run: npm run clear && tsc -P ./tsconfig.app.json && npm run post:build or tsc -p .
node version: v12.13.0
npm: v6.14.2
Express: 4
Does someone already have the same problem?
> tsc -p .
node_modules/#types/readable-stream/index.d.ts:14:15 - error TS2417: Class static side 'typeof _Readable' incorrectly extends base class static side 'typeof Readable'.
The types of '(new Stream.Readable.Duplex(...))._destroy' are incompatible between these types.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
14 declare class _Readable extends stream.Readable {
~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Duplex'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Writable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type '_Readable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:102:11 - error TS2720: Class '_Readable.PassThrough' incorrectly implements class 'import("stream").PassThrough'. Did you mean to extend 'import("stream").PassThrough' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
102 class PassThrough extends Transform implements stream.PassThrough {
~~~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:138:18 - error TS2749: 'StringDecoder' refers to a value, but is being used as a type here.
138 decoder: StringDecoder | null;
~~~~~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:164:11 - error TS2720: Class '_Readable.Transform' incorrectly implements class 'import("stream").Transform'. Did you mean to extend 'import("stream").Transform' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
164 class Transform extends Duplex implements stream.Transform {
~~~~~~~~~
Found 7 errors.
Try adding
"#types/node": "^12.12.7"
to devDependencies in package.json. then,
npm install
It worked for me. Cheers!!

ant-design: bad type declarations?

There is this tutorial on the main page: https://ant.design/docs/react/use-in-typescript it shows some example code that does not compile. In particular, <Button type="primary">Button</Button> does not compile because it should be htmlType and not type. Can somebody please confirm that this is true? Or is it just a problem with my installation?
Another problem I have noticed is that props for Button have bad type declaration. At least on my computer. I just installed antd, and I have this NativeButtonProps, which has htmlType?: ButtonHTMLType, and that is declared as: export declare type ButtonHTMLType = 'submit' | 'button' | 'reset';
This is very confusing because the documentation says that there are types called "primary" "dashed" and "danger". Is this also a problem with the declaration?
Is it possible that I have a broken installation but I doubt. I have tried to install everything from scratch on a computer that had no node.js installed. But the result is the same. What am I doing wrong?
UPDATE more details on the problem. If I use this code:
<Button type="primary">Buttonka</Button>
Then I get this compilation error and it won't generate js code:
C:/TypeScript/antd-demo-ts/src/App.tsx
(10,10): Type '{ children: string; type: "primary"; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & Pick & Readonly & Pick, "htmlType">, "color" | ... 258 more ... | "htmlType"> & Partial<...> & Partial<...>) | ...'.
Type '{ children: string; type: "primary"; }' is not assignable to type 'Pick & Readonly & Pick, "htmlType">, "color" | ... 262 more ... | "value">'.
Property 'htmlType' is missing in type '{ children: string; type: "primary"; }'.
If I use htmlType="primary" instead, then I get the following warning:
{
"resource": "/c:/TypeScript/antd-demo-ts/src/App.tsx",
"owner": "typescript",
"code": "2322",
"severity": 8,
"message": "Type '{ children: string; htmlType: \"primary\"; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & R...'.\n Type '{ children: string; htmlType: \"primary\"; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly<{ children?: ReactNode; }> & Re...'.\n Type '{ children: string; htmlType: \"primary\"; }' is not assignable to type 'Readonly'.\n Types of property 'htmlType' are incompatible.\n Type '\"primary\"' is not assignable to type '\"submit\" | \"button\" | \"reset\" | undefined'.",
"source": "ts",
"startLineNumber": 10,
"startColumn": 10,
"endLineNumber": 10,
"endColumn": 16
}
and in this case the TypeScript code is compiled, but the button is shown as opaque/white, and it is not primary/blue.
It is a fact that the css has been imported into App.tsx:
import './App.css';
and also the ant design css has been imported in App.css:
#import '~antd/dist/antd.css';
But either way, I can't set the primary (blue) style on the button.

ConsumerGroup consumerOptions Configuration error #types/kafka-node

I'm trying to use consumerGroup instead of HighLevelConsumer in a typescript project, but I'm not able to configure consumerOptions for consumerGroup.
I am getting the following error when I assign
1) fromOffset: 'earliest'
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number;
fetchMaxWaitMs: number; fromOffset: string; groupId...' is not
assignable to parameter of type 'ConsumerGroupOptions'. Types of
property 'fromOffset' are incompatible. Type 'string' is not
assignable to type '"earliest" | "latest" | "none"'.
2) protocol: ['roundrobin']
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number;
fetchMaxWaitMs: number; protocol: string[]; groupId...' is not
assignable to parameter of type 'ConsumerGroupOptions'. Types of
property 'protocol' are incompatible. Type 'string[]' is not
assignable to type '("roundrobin" | "range" |
CustomPartitionAssignmentProtocol)[]'. Type 'string' is not assignable
to type '"roundrobin" | "range" | CustomPartitionAssignmentProtocol'.
3) outOfRangeOffset: 'earliest'
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number;
fetchMaxWaitMs: number; outOfRangeOffset: string; g...' is not
assignable to parameter of type 'ConsumerGroupOptions'. Types of
property 'outOfRangeOffset' are incompatible. Type 'string' is not
assignable to type '"earliest" | "latest" | "none"'.
Environment details:
Node version: v8.11.1
Kafka-node version: v2.6.1
types/kafka-node: v2.0.6
Can anyone help me understand where I am going wrong? Thanks in advance.

Resources