Skip to content

Extending defined classes #136

@paulhiggs

Description

@paulhiggs

When using libxml2-wasm in Javascript, I am able to create some additional "helper" methods within XmlElement and XmlDocument (you can see them in my project - libxml2-wasm-extensions.mjs)

Now I look to migrate the project to TypeScript and note that the relevant headers are, thankfully, already provided, however, I am not able to use the normal mechanisms of TypeScript to extend the classes. For example, I can extend the express.Request and express.Response classes (in my express-extensions.d.ts) with

declare global {
	namespace Express {
		export interface Request {
			parseErr? : string;
		}

		export interface Response {
			varyOn? : Array<string>; 
	 	}
	}
}

Is it possible to extend the types defined for libxml2-wasm?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions