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

Adds DeepReadonly #17

Closed
wants to merge 2 commits into from

Conversation

ericanderson
Copy link

foo.bam.push({ bap: [] });

// $ExpectError
foo.bab.bab.bab = "hi";
Copy link
Owner

Choose a reason for hiding this comment

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

It would be good to have some $ExpectTypes as well, to establish the positive properties of this operator.

types/index.d.ts Outdated
/**
* Creates a type that only includes the properties which are functions in T.
*/
export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
Copy link
Owner

@pelotom pelotom May 8, 2018

Choose a reason for hiding this comment

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

These don't seem to me to be of general enough utility to define them as top-level exports. I would get rid of FunctionPropertyNames/FunctionProperties since they aren't needed in the definition of DeepReadonly, and inline NonFunctionPropertyNames/NonFunctionProperties.

types/index.d.ts Outdated
export type DeepReadonlyObject<T> = {
readonly [P in NonFunctionPropertyNames<T>]: DeepReadonly<T[P]>;
// tslint:disable-next-line: semicolon strict-export-declare-modifiers ban-types
readonly [P in { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]]: DeepReadonly<T[P]>;
Copy link
Owner

Choose a reason for hiding this comment

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

I would inline DeepReadonlyArray and DeepReadonlyObject as well.

Also the build is failing currently.

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