Skip to content

Commit 586f729

Browse files
Merge branch 'master' into callback-to-promises
2 parents 8f364b6 + cd830d1 commit 586f729

16 files changed

+46
-50
lines changed

src/cli/domain/get-mocked-plugins.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const defaultRegister = (
4545
};
4646

4747
const registerStaticMocks = (
48-
mocks: Dictionary<string>,
48+
mocks: Record<string, string>,
4949
logger: Logger
5050
): PluginMock[] =>
5151
_.map(mocks, (mockedValue, pluginName) => {
@@ -62,7 +62,7 @@ const registerStaticMocks = (
6262

6363
const registerDynamicMocks = (
6464
ocJsonLocation: string,
65-
mocks: Dictionary<string>,
65+
mocks: Record<string, string>,
6666
logger: Logger
6767
) =>
6868
_.map(mocks, (source, pluginName) => {

src/cli/domain/handle-dependencies/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export default async function handleDependencies(options: {
2828
}> {
2929
const { components, logger, useComponentDependencies } = options;
3030

31-
const dependencies: Dictionary<string> = {};
32-
const addDependencies = (componentDependencies?: Dictionary<string>) =>
31+
const dependencies: Record<string, string> = {};
32+
const addDependencies = (componentDependencies?: Record<string, string>) =>
3333
Object.entries(componentDependencies || {}).forEach(
3434
([dependency, version]) => {
3535
dependencies[dependency] = version;

src/cli/domain/handle-dependencies/require-template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Template {
1717
verbose: boolean;
1818
production: boolean | undefined;
1919
},
20-
cb: Callback<Component>
20+
cb: (err: Error | null, data: Component) => void
2121
) => void;
2222
}
2323

src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type Command = {
6161
cmd: string;
6262
};
6363
options?: any;
64-
commands?: Dictionary<Command>;
64+
commands?: Record<string, Command>;
6565
};
6666

6767
function processCommand(

src/globals.d.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ declare module 'minimal-request' {
8080
method?: string;
8181
body?: unknown;
8282
url: string;
83-
headers?: Dictionary<string | null | undefined | string[]>;
83+
headers?: Record<string, string | null | undefined | string[]>;
8484
json?: boolean;
8585
},
8686
cb: (
8787
err: Error | number | null,
8888
body: T,
8989
details: {
9090
response: {
91-
headers: Dictionary<string>;
91+
headers: Record<string, string>;
9292
};
9393
}
9494
) => void
@@ -98,10 +98,3 @@ declare module 'minimal-request' {
9898

9999
export = request;
100100
}
101-
102-
declare type Callback<T = undefined, E = Error> = (
103-
err: E | null,
104-
data: T
105-
) => void;
106-
107-
declare type Dictionary<T> = Record<string, T>;

src/registry/domain/authentication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const basicAuthentication: Authentication<{
3535
}
3636
};
3737

38-
const builtin: Dictionary<Authentication> = {
38+
const builtin: Record<string, Authentication> = {
3939
basic: basicAuthentication
4040
};
4141

src/registry/domain/nested-renderer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import settings from '../../resources/settings';
55
import strings from '../../resources';
66
import { Config } from '../../types';
77

8-
type Cb = Callback<string, string>;
8+
type Cb = (err: string | null, data: string) => void;
99
type Options = {
1010
version?: string;
1111
name?: string;
12-
headers?: Dictionary<string>;
13-
parameters?: Dictionary<string>;
12+
headers?: Record<string, string>;
13+
parameters?: Record<string, string>;
1414
};
1515
type Params = {
1616
components: Options[];

src/registry/domain/register-templates.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Template, TemplateInfo } from '../../types';
55
import _ from 'lodash';
66

77
export default function registerTemplates(extraTemplates: Template[]): {
8-
templatesHash: Dictionary<Template>;
8+
templatesHash: Record<string, Template>;
99
templatesInfo: TemplateInfo[];
1010
} {
1111
const coreTemplates: Template[] = [
@@ -18,7 +18,7 @@ export default function registerTemplates(extraTemplates: Template[]): {
1818
const type = template.getInfo().type;
1919
hash[type] = template;
2020
return hash;
21-
}, {} as Dictionary<Template>);
21+
}, {} as Record<string, Template>);
2222

2323
const templatesInfo = templates.map(template => {
2424
return template.getInfo();

src/registry/domain/sanitiser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ const sanitise = {
3434
const toRemove = ['__ocAcceptLanguage'];
3535

3636
export function sanitiseComponentParameters(
37-
requestParameters: Dictionary<string | number | boolean>,
38-
expectedParameters: Dictionary<OcParameter>
39-
): Dictionary<string | number | boolean> {
40-
const result: Dictionary<string | number | boolean> = {};
37+
requestParameters: Record<string, string | number | boolean>,
38+
expectedParameters: Record<string, OcParameter>
39+
): Record<string, string | number | boolean> {
40+
const result: Record<string, string | number | boolean> = {};
4141

4242
for (const [requestParameterName, requestParameter] of Object.entries(
4343
requestParameters

src/registry/domain/url-builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import url from 'url';
44
type Component = {
55
name: string;
66
version?: string;
7-
parameters?: Dictionary<string>;
7+
parameters?: Record<string, string>;
88
};
99

1010
function componentForType(
@@ -61,7 +61,7 @@ export function componentPreview(
6161

6262
return href;
6363
}
64-
export function queryString(parameters: Dictionary<string> = {}): string {
64+
export function queryString(parameters: Record<string, string> = {}): string {
6565
let qs = '';
6666

6767
if (Object.keys(parameters).length > 0) {

0 commit comments

Comments
 (0)