mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-14 04:46:34 +03:00
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.
This commit is contained in:
parent
168189b2fd
commit
127ef260b9
2
custom.d.ts
vendored
2
custom.d.ts
vendored
|
@ -23,5 +23,3 @@ declare var reactHotLoaderGlobal: any;
|
||||||
interface Element {
|
interface Element {
|
||||||
scrollIntoViewIfNeeded(centerIfNeeded?: boolean): void;
|
scrollIntoViewIfNeeded(centerIfNeeded?: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenericObject = Record<string, any>;
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { StyledComponent } from 'styled-components';
|
||||||
import { DropdownProps, MimeLabel, SimpleDropdown } from '../../common-elements/Dropdown';
|
import { DropdownProps, MimeLabel, SimpleDropdown } from '../../common-elements/Dropdown';
|
||||||
|
|
||||||
export interface DropdownOrLabelProps extends DropdownProps {
|
export interface DropdownOrLabelProps extends DropdownProps {
|
||||||
Label?: StyledComponent<any, any, GenericObject, never>;
|
Label?: StyledComponent<any, any, Record<string, any>, never>;
|
||||||
Dropdown?: StyledComponent<
|
Dropdown?: StyledComponent<
|
||||||
React.NamedExoticComponent<DropdownProps>,
|
React.NamedExoticComponent<DropdownProps>,
|
||||||
any,
|
any,
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class OpenAPIParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(spec: GenericObject): void {
|
validate(spec: Record<string, any>): void {
|
||||||
if (spec.openapi === undefined) {
|
if (spec.openapi === undefined) {
|
||||||
throw new Error('Document must be valid OpenAPI 3.0.0 definition');
|
throw new Error('Document must be valid OpenAPI 3.0.0 definition');
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ export class OpenAPIParser {
|
||||||
} else {
|
} else {
|
||||||
// small optimization
|
// small optimization
|
||||||
return {
|
return {
|
||||||
...(resolved as GenericObject),
|
...(resolved as object),
|
||||||
...rest,
|
...rest,
|
||||||
} as T;
|
} as T;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export function objectHas(object: GenericObject, path: string | Array<string>): boolean {
|
export function objectHas(object: object, path: string | Array<string>): boolean {
|
||||||
let _path = <Array<string>>path;
|
let _path = <Array<string>>path;
|
||||||
|
|
||||||
if (typeof path === 'string') {
|
if (typeof path === 'string') {
|
||||||
|
@ -12,7 +12,7 @@ export function objectHas(object: GenericObject, path: string | Array<string>):
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function objectSet(object: GenericObject, path: string | Array<string>, value: any): void {
|
export function objectSet(object: object, path: string | Array<string>, value: any): void {
|
||||||
let _path = <Array<string>>path;
|
let _path = <Array<string>>path;
|
||||||
|
|
||||||
if (typeof path === 'string') {
|
if (typeof path === 'string') {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user