Skip to content

Conversation

weswigham
Copy link
Member

Just a small cleanup that uses some newer language features to delete ~10 lines of code form types.ts.

@weswigham weswigham requested review from sandersn and rbuckton March 30, 2019 00:27
UnionToIntersection<{
[K in keyof NonNullable<T["args"]>]: PragmaArgTypeOptional<
NonNullable<T["args"]>[K],
NonNullable<T["args"]>[K] extends {name: infer TName} ? TName extends string ? TName : never : never
Copy link
Member Author

Choose a reason for hiding this comment

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

This should just be

Suggested change
NonNullable<T["args"]>[K] extends {name: infer TName} ? TName extends string ? TName : never : never
NonNullable<T["args"]>[K]["name"]

but we get the constraint of NonNullable<T["args"]>[K] wrong and error on that, it seems. I'm sure more future improvements will render this fixed and simplifiable, too.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks like the linter is confused about one of the type assertions.

@weswigham weswigham merged commit ca98a50 into microsoft:master Apr 2, 2019
@weswigham weswigham deleted the simplify-types-pragmas-a-bit branch April 2, 2019 20:04
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

Successfully merging this pull request may close these issues.

2 participants