Skip to content

Commit e93b188

Browse files
committed
feature: @putout/plugin-typescript: apply-utility-types: Optional: add
1 parent 6ab5bf2 commit e93b188

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type More = Omit<Hello, World>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
type More = Pick<Hello, Exclude<keyof Hello, World>>;

packages/plugin-typescript/lib/apply-utility-types/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ module.exports.replace = () => ({
66
'type __a = {readonly [__b in keyof __c]: __c[__b];}': 'type __a = Readonly<__c>',
77
'type __a = {[__b in keyof __c]?: __c[__b];}': 'type __a = Partial<__c>',
88
'type __a = {[__b in keyof __c]-?: __c[__b];}': 'type __a = Required<__c>',
9+
'type __a = Pick<__b, Exclude<keyof __b, __c>>': 'type __a = Omit<__b, __c>',
910
});

packages/plugin-typescript/lib/apply-utility-types/index.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ test('plugin-apply-typescript: apply-utility-types: transform: mapped-types', (t
1818
t.transform('mapped-types');
1919
t.end();
2020
});
21+
22+
test('plugin-apply-typescript: apply-utility-types: transform: optional', (t) => {
23+
t.transform('optional');
24+
t.end();
25+
});

0 commit comments

Comments
 (0)