提问者:小点点

尝试上传G-Cloud-Function时出错


我在上传我的云功能到Firebase时遇到了一个问题。 使用Typescript,我需要进行一些XML解析,因此需要一个名为xmldom-ts的包,但它向我显示了这个抽象错误:

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.

知道我为什么会出错吗? 我的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和vscode没有显示问题/警告& 我尝试了多次npm重新安装。


共1个答案

匿名用户

从包中删除xmldom-ts解决了这个问题

npm uninstall xmldom-ts