Doesn't handle keyof and typeof #12

Closed
opened 2019-08-14 13:57:02 +02:00 by adrianheine · 5 comments
adrianheine commented 2019-08-14 13:57:02 +02:00 (Migrated from github.com)

gettypes emits keyof and typeof with single typeArgs. Unless we want to add a generic type operator thing we need to hardcode them in the templates.

gettypes emits `keyof` and `typeof` with single `typeArgs`. Unless we want to add a generic type operator thing we need to hardcode them in the templates.
marijnh commented 2019-08-14 14:36:03 +02:00 (Migrated from github.com)

I think the type param kludge is preferable to a separate property, since it is harder to accidentally 'drop' the operator by ignoring the property for it this way (i.e. in its current form, builddocs' output will at least convey the information that the operator is there, even if it should format it more TypeScript-like). But yeah, we should add a special case to the type template for these.

I think the type param kludge is preferable to a separate property, since it is harder to accidentally 'drop' the operator by ignoring the property for it this way (i.e. in its current form, builddocs' output will at least convey the information that the operator is there, even if it should format it more TypeScript-like). But yeah, we should add a special case to the type template for these.
adrianheine commented 2019-08-14 14:48:11 +02:00 (Migrated from github.com)

A generic thing could look like {type: "operation", operator: "typeof", typeArgs: ["X"]}. I'm still wondering if putting both user-defined types and syntax types in type is a good thing to do …

A generic thing could look like `{type: "operation", operator: "typeof", typeArgs: ["X"]}`. I'm still wondering if putting both user-defined types and syntax types in `type` is a good thing to do …
marijnh commented 2019-08-14 14:53:02 +02:00 (Migrated from github.com)

It seemed like a convenient encoding for the above reasons, and because typeOrigin=null can be used to unambiguously distinguish these from user-defined types with the same names. But yeah, what you describe would use the fields in a somewhat more structured way, and if you want to move to that I'm fine with it too (I assume union/intersection would also follow that form?).

It seemed like a convenient encoding for the above reasons, and because `typeOrigin=null` can be used to unambiguously distinguish these from user-defined types with the same names. But yeah, what you describe would use the fields in a somewhat more structured way, and if you want to move to that I'm fine with it too (I assume union/intersection would also follow that form?).
adrianheine commented 2019-08-20 14:37:18 +02:00 (Migrated from github.com)

I tried it out, but it doesn't actually help, since the output for most operations (except single keyword operations) is specific.

I tried it out, but it doesn't actually help, since the output for most operations (except single keyword operations) is specific.
adrianheine commented 2019-09-03 09:02:49 +02:00 (Migrated from github.com)

Fixed in #15.

Fixed in #15.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/builddocs#12
No description provided.