debt - have Dto and UriDto

This commit is contained in:
Johannes Rieken
2020-02-21 10:08:55 +01:00
parent c975df3b59
commit 798a4026ef
3 changed files with 17 additions and 8 deletions
+13 -4
View File
@@ -266,10 +266,19 @@ export type AddFirstParameterToFunctions<Target, TargetFunctionsReturnType, Firs
};
/**
* Mapped typed that replaces all occurrences of URI with UriComponents
* todo@joh drop functions
* Mapped-type that replaces all occurrences of URI with UriComponents
*/
export type UriDto<T> = { [K in keyof T]: T[K] extends URI
? UriComponents
: UriDto<T[K]> };
/**
* Mapped-type that replaces all occurrences of URI with UriComponents and
* drops all functions.
* todo@joh use toJSON-results
*/
export type Serialized<T> = { [K in keyof T]: T[K] extends URI
export type Dto<T> = { [K in keyof T]: T[K] extends URI
? UriComponents
: Serialized<T[K]> };
: T[K] extends Function
? never
: UriDto<T[K]> };
+2 -2
View File
@@ -13,7 +13,7 @@ import { IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Event, Emitter } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { Serialized } from 'vs/base/common/types';
import { UriDto } from 'vs/base/common/types';
export interface ILocalizedString {
value: string;
@@ -29,7 +29,7 @@ export interface ICommandAction {
toggled?: ContextKeyExpr;
}
export type ISerializableCommandAction = Serialized<ICommandAction>;
export type ISerializableCommandAction = UriDto<ICommandAction>;
export interface IMenuItem {
command: ICommandAction;
@@ -52,7 +52,7 @@ import { TunnelOptions } from 'vs/platform/remote/common/tunnel';
import { Timeline, TimelineChangeEvent, TimelineCursor, TimelineProviderDescriptor } from 'vs/workbench/contrib/timeline/common/timeline';
import { revive } from 'vs/base/common/marshalling';
import { CallHierarchyItem } from 'vs/workbench/contrib/callHierarchy/common/callHierarchy';
import { Serialized } from 'vs/base/common/types';
import { Dto } from 'vs/base/common/types';
export interface IEnvironment {
isExtensionDevelopmentDebug: boolean;
@@ -1191,7 +1191,7 @@ export interface ICodeLensDto {
command?: ICommandDto;
}
export type ICallHierarchyItemDto = Serialized<CallHierarchyItem>;
export type ICallHierarchyItemDto = Dto<CallHierarchyItem>;
export interface IIncomingCallDto {
from: ICallHierarchyItemDto;