Skip to content

Commit 127ef26

Browse files
authored
fix: remove GenericObject shim (#2177)
This was declared in the local stubs file but not shipped, meaning that consumers with typescript libchecking enabled would have to also add the GenericObject definition to their local stubs file. This commit inlines the definition where necessary, or replaces it with object where appropriate.
1 parent 168189b commit 127ef26

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

custom.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,3 @@ declare var reactHotLoaderGlobal: any;
2323
interface Element {
2424
scrollIntoViewIfNeeded(centerIfNeeded?: boolean): void;
2525
}
26-
27-
type GenericObject = Record<string, any>;

src/components/DropdownOrLabel/DropdownOrLabel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { StyledComponent } from 'styled-components';
44
import { DropdownProps, MimeLabel, SimpleDropdown } from '../../common-elements/Dropdown';
55

66
export interface DropdownOrLabelProps extends DropdownProps {
7-
Label?: StyledComponent<any, any, GenericObject, never>;
7+
Label?: StyledComponent<any, any, Record<string, any>, never>;
88
Dropdown?: StyledComponent<
99
React.NamedExoticComponent<DropdownProps>,
1010
any,

src/services/OpenAPIParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class OpenAPIParser {
4141
}
4242
}
4343

44-
validate(spec: GenericObject): void {
44+
validate(spec: Record<string, any>): void {
4545
if (spec.openapi === undefined) {
4646
throw new Error('Document must be valid OpenAPI 3.0.0 definition');
4747
}
@@ -153,7 +153,7 @@ export class OpenAPIParser {
153153
} else {
154154
// small optimization
155155
return {
156-
...(resolved as GenericObject),
156+
...(resolved as object),
157157
...rest,
158158
} as T;
159159
}

src/utils/object.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function objectHas(object: GenericObject, path: string | Array<string>): boolean {
1+
export function objectHas(object: object, path: string | Array<string>): boolean {
22
let _path = <Array<string>>path;
33

44
if (typeof path === 'string') {
@@ -12,7 +12,7 @@ export function objectHas(object: GenericObject, path: string | Array<string>):
1212
});
1313
}
1414

15-
export function objectSet(object: GenericObject, path: string | Array<string>, value: any): void {
15+
export function objectSet(object: object, path: string | Array<string>, value: any): void {
1616
let _path = <Array<string>>path;
1717

1818
if (typeof path === 'string') {

0 commit comments

Comments
 (0)