Skip to content
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

[Typescript] Attribute interface is wrong (wrong property name for "name"). #124

Closed
Supamiu opened this issue May 6, 2016 · 10 comments
Closed
Labels

Comments

@Supamiu
Copy link

Supamiu commented May 6, 2016

This issue is a d.ts problem. in parse5/index.d.ts, you have this interface :

export interface Attribute {
        key: string;
        value: string;
    }

But if you get a node and log its attributes, you have this:

{ name: 'foo', value: 'bar' }

Proof:

import * as parse5 from "parse5";
import {treeAdapters} from "parse5";
let example = "<div foo='bar'></div>";
let node = parse5.parseFragment(example);
console.log(treeAdapters.default.getAttrList(node.childNodes[0]));

then check index.d.ts to see that the interface is not the good one (property "key" should be named "name").

@RReverser
Copy link
Collaborator

Cool, want to send a PR?

@inikulin
Copy link
Owner

inikulin commented May 6, 2016

I guess this issue relates to DefinetlyTyped because we don't ship any .d.ts files.

@Supamiu
Copy link
Author

Supamiu commented May 6, 2016

I'll send a PR to DefinetlyTyped then, thank you for your answer @inikulin.

@Supamiu Supamiu closed this as completed May 6, 2016
@RReverser
Copy link
Collaborator

@inikulin I think it would be nice to ship them by the way, as their new typings approach allows libraries to ship & maintain their own typings without need to update anything in the DefinitelyTyped.

@inikulin
Copy link
Owner

inikulin commented May 6, 2016

Makes sense. Is there any tool that generates .d.ts from jsdoc comments?

@RReverser
Copy link
Collaborator

Well, I know they've added jsdoc support as part of microsoft/TypeScript#4789 meta-issue which allows to detect JSDoc types as if they were native TypeScript types, but I'm not sure if there's a tool to generate definitions out of that info.

@RReverser
Copy link
Collaborator

Some interesting links here DefinitelyTyped/DefinitelyTyped#2103

@RReverser
Copy link
Collaborator

We might want to try https://github.com/fivetran/typescript-closure-tools - I suppose Closure annotations are compatible with JSDoc?

@inikulin
Copy link
Owner

inikulin commented May 6, 2016

Created separate issue: #125

@Supamiu
Copy link
Author

Supamiu commented May 6, 2016

Issue created on DefinetlyTyped: DefinitelyTyped/DefinitelyTyped#9235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants