Improve types

This commit is contained in:
Daniel Imms
2016-10-01 15:35:45 -07:00
parent 494a4cc216
commit 0a034851c9

View File

@@ -4,10 +4,27 @@ export interface IVscodeJsonTheme {
name?: string; name?: string;
include?: string; include?: string;
globalSettings?: { globalSettings?: {
background?: string; background?: string
foreground?: string; foreground?: string
};
settings?: IVscodeJsonThemeSetting[];
}
export interface IVscodeJsonGlobalSetting {
name: string;
settings: {
background?: string
foreground?: string
};
}
export interface IVscodeJsonThemeSetting {
name: string;
scope: string;
settings: {
foreground?: string
fontStyle?: string
}; };
settings?: any[];
} }
type SourceFetcher = (colorSet: IColorSet) => string; type SourceFetcher = (colorSet: IColorSet) => string;
@@ -27,18 +44,18 @@ enum FontStyle {
function getGlobalSettingGenerator(name: string): ColorGenerator { function getGlobalSettingGenerator(name: string): ColorGenerator {
return (color: string) => { return (color: string) => {
let globalSetting: any = { let globalSetting: IVscodeJsonGlobalSetting = {
'name': name, 'name': name,
'settings': {} 'settings': {}
}; };
globalSetting.settings[name] = color; (<any>globalSetting.settings)[name] = color;
return globalSetting; return globalSetting;
}; };
} }
function getSimpleColorGenerator(name: string, scope: string, fontStyle: number = FontStyle.NONE): ColorGenerator { function getSimpleColorGenerator(name: string, scope: string, fontStyle: number = FontStyle.NONE): ColorGenerator {
return (color: string) => { return (color: string) => {
let colorRule: any = { let colorRule: IVscodeJsonThemeSetting = {
'name': name, 'name': name,
'scope': scope, 'scope': scope,
'settings': { 'settings': {