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

Feat is never #115

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Feat is never #115

wants to merge 4 commits into from

Conversation

andnp
Copy link
Owner

@andnp andnp commented Jul 22, 2019

No description provided.

@andnp andnp requested a review from Retsam as a code owner July 22, 2019 02:16
andnp added 4 commits July 21, 2019 20:55
Thanks to @krisdages for finding this! This commit removes the `string`
condition on `IsNever` because `keyof never === keyof any === string`.

Closes: #109
The tests for this were purely focused around the string form. This
commit adds more complete tests to account for the wider range of
applicability.

This commit also simplifies the conditional of the original form.
The new `IsNever` only works with 3.5, so all older versions need to be
dropped. This will bump the major version of `simplytyped` to avoid any
breaking changes.

I think it is worth it to drop older versions of the language to keep
this package from rotting too severely, as long as we are careful with
updating the major version whenever we change the supported TS versions.

BREAKING CHANGE: no longer supporting typescript < 3.5
@@ -15,7 +15,7 @@ export type ObjectPrototypeKeys = keyof Object;
/** no-doc */
export type FunctionPrototypeKeys = keyof Function;

export type IsNever<S extends string> = Not<(Record<S, True> & Record<string, False>)[S]>;
export type IsNever<T> = keyof any extends keyof T ? Not<IsAny<T>> : False;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's weird to me that keyof never is the same as keyof any, while keyof unknown is never. This feels like the sort of thing that might break in a later version of TS, but I suppose that's what the tests are for...

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