Skip to content

parse5.d.ts : Wrong interface or method return type. #9235

New issue

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

Closed
4 tasks done
Supamiu opened this issue May 6, 2016 · 2 comments
Closed
4 tasks done

parse5.d.ts : Wrong interface or method return type. #9235

Supamiu opened this issue May 6, 2016 · 2 comments

Comments

@Supamiu
Copy link
Contributor

Supamiu commented May 6, 2016

  • I tried using the latest parse5/parse5.d.ts file in this repo and had problems.
  • I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • I want to talk about xxxx/xxxx.d.ts.

When you call treeAdapters.default.getAttrList(node) you get an Attribute[]. So, if you want to add an attribute to this node, you have to do something like treeAdapters.default.getAttrList(node).push({key: 'foo', value:'bar'}).

Problem is that key property is ignored, because this should be an ASTAttribute[] or Attribute interface should have name instead of key. Since I don't know which one is the good fix, created an issue instead of a PR.

@vvakame
Copy link
Member

vvakame commented May 9, 2016

@Supamiu please send a pull request. I'll review it.

@Supamiu
Copy link
Contributor Author

Supamiu commented May 18, 2016

@vvakame problem is that I don't know which one would be the good fix, since I'm not a parse5 developer, I don't know if I should edit getAttrList(node) return type or Attribute interface.

Supamiu pushed a commit to Supamiu/DefinitelyTyped that referenced this issue May 30, 2016
…able to add attributes to a node, getAttrList() returns an ASTAttribute[] not an Attribute[] because its entries does not contain property 'key' but they do have property 'name'. Fixes DefinitelyTyped#9235
Supamiu pushed a commit to Supamiu/DefinitelyTyped that referenced this issue May 30, 2016
…able to add attributes to a node, getAttrList() returns an ASTAttribute[] not an Attribute[] because its entries does not contain property 'key' but they do have property 'name'. Fixes DefinitelyTyped#9235
vvakame pushed a commit that referenced this issue Jun 2, 2016
* [Fix] Edited getAttrList() signature to fix an issue making parse5 unable to add attributes to a node, getAttrList() returns an ASTAttribute[] not an Attribute[] because its entries does not contain property 'key' but they do have property 'name'. Fixes #9235

* [Fix] Edited getAttrList() signature to fix an issue making parse5 unable to add attributes to a node, getAttrList() returns an ASTAttribute[] not an Attribute[] because its entries does not contain property 'key' but they do have property 'name'. Fixes #9235
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants