Skip to content

Commit b95cbe5

Browse files
committedSep 16, 2019
Fix compatibility with TS <3.5
·
v4.41.0v0.8.0
1 parent aca5802 commit b95cbe5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎.github/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- Write a good documentation comment that includes:
1111
- Write a short and clear description of the type does.
1212
- Write about some real-world use-cases where it can be useful. (It can be hard sometimes for users to see where they would use something)
13-
- Example code block
13+
- Example code block with a realistic example.
1414
- At the bottom, explain how the type works. Some types can be quite advanced and hard to understand. We can use this opportunity to teach users.
1515
- If there has been any discussion somewhere about this type, include a link to it. For example, a discussion on the TypeScript issue tracker.
1616
- If you add any internal helper types, they should still be properly documented and tested.

‎source/require-exactly-one.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// TODO: Remove this when we target TypeScript >=3.5.
2+
// eslint-disable-next-line @typescript-eslint/generic-type-naming
3+
type _Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
4+
15
/**
26
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
37
@@ -29,4 +33,4 @@ export type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = ke
2933
{[Key in KeysType]: (
3034
Required<Pick<ObjectType, Key>> &
3135
Partial<Record<Exclude<KeysType, Key>, never>>
32-
)}[KeysType] & Omit<ObjectType, KeysType>; // eslint-disable-line @typescript-eslint/ban-types
36+
)}[KeysType] & _Omit<ObjectType, KeysType>;

0 commit comments

Comments
 (0)
Please sign in to comment.