Skip to content

Commit 798a402

Browse files
committed
debt - have Dto and UriDto
1 parent c975df3 commit 798a402

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/vs/base/common/types.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,19 @@ export type AddFirstParameterToFunctions<Target, TargetFunctionsReturnType, Firs
266266
};
267267

268268
/**
269-
* Mapped typed that replaces all occurrences of URI with UriComponents
270-
* todo@joh drop functions
269+
* Mapped-type that replaces all occurrences of URI with UriComponents
270+
*/
271+
export type UriDto<T> = { [K in keyof T]: T[K] extends URI
272+
? UriComponents
273+
: UriDto<T[K]> };
274+
275+
/**
276+
* Mapped-type that replaces all occurrences of URI with UriComponents and
277+
* drops all functions.
271278
* todo@joh use toJSON-results
272279
*/
273-
export type Serialized<T> = { [K in keyof T]: T[K] extends URI
280+
export type Dto<T> = { [K in keyof T]: T[K] extends URI
274281
? UriComponents
275-
: Serialized<T[K]> };
282+
: T[K] extends Function
283+
? never
284+
: UriDto<T[K]> };

src/vs/platform/actions/common/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
1313
import { Event, Emitter } from 'vs/base/common/event';
1414
import { URI } from 'vs/base/common/uri';
1515
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
16-
import { Serialized } from 'vs/base/common/types';
16+
import { UriDto } from 'vs/base/common/types';
1717

1818
export interface ILocalizedString {
1919
value: string;
@@ -29,7 +29,7 @@ export interface ICommandAction {
2929
toggled?: ContextKeyExpr;
3030
}
3131

32-
export type ISerializableCommandAction = Serialized<ICommandAction>;
32+
export type ISerializableCommandAction = UriDto<ICommandAction>;
3333

3434
export interface IMenuItem {
3535
command: ICommandAction;

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import { TunnelOptions } from 'vs/platform/remote/common/tunnel';
5252
import { Timeline, TimelineChangeEvent, TimelineCursor, TimelineProviderDescriptor } from 'vs/workbench/contrib/timeline/common/timeline';
5353
import { revive } from 'vs/base/common/marshalling';
5454
import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
55-
import { Serialized } from 'vs/base/common/types';
55+
import { Dto } from 'vs/base/common/types';
5656

5757
export interface IEnvironment {
5858
isExtensionDevelopmentDebug: boolean;
@@ -1191,7 +1191,7 @@ export interface ICodeLensDto {
11911191
command?: ICommandDto;
11921192
}
11931193

1194-
export type ICallHierarchyItemDto = Serialized<CallHierarchyItem>;
1194+
export type ICallHierarchyItemDto = Dto<CallHierarchyItem>;
11951195

11961196
export interface IIncomingCallDto {
11971197
from: ICallHierarchyItemDto;

0 commit comments

Comments
 (0)