We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import { Equal } from '@type-challenges/utils' type GetReadonlyKeys<T, R extends T = Readonly<T>> = { [K in keyof T]-?: Equal<Pick<R, K>, Pick<T, K>> extends true ? K : never; }[keyof T];
/* _____________ Test Cases _____________ */ import { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<'title', GetReadonlyKeys<Todo1>>>, Expect<Equal<'title' | 'description', GetReadonlyKeys<Todo2>>>, ] interface Todo1 { readonly title: string description: string completed: boolean } interface Todo2 { readonly title: string readonly description: string completed?: boolean }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
5 - Get Readonly Keys
Code
Test cases
The text was updated successfully, but these errors were encountered: