We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
match
walk
When running the type check on my codebase, I have those 2 errors in postsvg:
postsvg
node_modules/postsvg/postsvg.d.ts:74:5 - error TS7010: 'match', which lacks return-type annotation, implicitly has an 'any' return type. 74 match(expression: posthtml.Matcher, callback: (node: Node) => Node); ~~~~~ node_modules/postsvg/postsvg.d.ts:75:5 - error TS7010: 'walk', which lacks return-type annotation, implicitly has an 'any' return type. 75 walk(callback: (node: Node) => Node); ~~~~
This is because in postsvg.d.ts, there is no return type for both match and walk:
postsvg.d.ts
class Tree extends Array { static createFromArray(array: Array): Tree; get root(): Node; toString(): string; clone(): Tree; match(expression: posthtml.Matcher, callback: (node: Node) => Node); walk(callback: (node: Node) => Node); select(selector: string): Node[]; each(selector: string | TreeEachCallback, callack?: TreeEachCallback): Node[]; }
An easy fix could be to do the following:
class Tree extends Array { static createFromArray(array: Array): Tree; get root(): Node; toString(): string; clone(): Tree; match(expression: posthtml.Matcher, callback: (node: Node) => Node): void; walk(callback: (node: Node) => Node): void; select(selector: string): Node[]; each(selector: string | TreeEachCallback, callack?: TreeEachCallback): Node[]; }
But those 2 seems to be returning something (but I'm not sure what are the proper type)
Another easy fix could be:
class Tree extends Array { static createFromArray(array: Array): Tree; get root(): Node; toString(): string; clone(): Tree; match(expression: posthtml.Matcher, callback: (node: Node) => Node): unknown; walk(callback: (node: Node) => Node): unknown; select(selector: string): Node[]; each(selector: string | TreeEachCallback, callack?: TreeEachCallback): Node[]; }
But this isn't ideal either.
I can do a PR if you want, but I don't know which type to choose 😕
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When running the type check on my codebase, I have those 2 errors in
postsvg
:This is because in
postsvg.d.ts
, there is no return type for bothmatch
andwalk
:An easy fix could be to do the following:
But those 2 seems to be returning something (but I'm not sure what are the proper type)
Another easy fix could be:
But this isn't ideal either.
I can do a PR if you want, but I don't know which type to choose 😕
The text was updated successfully, but these errors were encountered: