Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Support object index signatures. #48

Merged
merged 1 commit into from
Dec 18, 2017
Merged

Support object index signatures. #48

merged 1 commit into from
Dec 18, 2017

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Dec 18, 2017

Closure Object<foo, bar> maps to TypeScript {[key: foo]: bar}.

  • CHANGELOG.md has been updated

@aomarks aomarks requested a review from rictic December 18, 2017 23:18
@aomarks aomarks force-pushed the object branch 3 times, most recently from e2c22f3 to 00b46e5 Compare December 18, 2017 23:21
@@ -264,6 +276,13 @@ function isBareArray(node: doctrine.Type):
return node.type === 'NameExpression' && node.name === 'Array';
}

function isParameterizedObject(node: doctrine.Type):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

node: doctrine.type.TypeApplication,
templateTypes: string[]): ts.IndexableObjectType|ts.NameType {
if (node.applications.length !== 2) {
console.error('Parameterized Object must have two parameters.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe assert and/or throw since this should be an internal error?

Copy link
Member Author

@aomarks aomarks Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not an internal error, actually there is a case in Polymer where a function was annotated with Object<Node> which isn't valid AFAIK (we are changing it).

Closure `Object<foo, bar>` maps to TypeScript `{[key: foo]: bar}`.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants