chore(types): convert type literals to records (#1615)

This commit is contained in:
Stanislav 2020-07-19 05:56:28 +03:00 committed by GitHub
parent b8db7ab889
commit fa5ddf8d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 5 deletions

View File

@ -102,7 +102,7 @@ export const decodeHtml: ParserOptions['decodeEntities'] = (
} }
// https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state // https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
const CCR_REPLACEMENTS: { [key: number]: number | undefined } = { const CCR_REPLACEMENTS: Record<number, number | undefined> = {
0x80: 0x20ac, 0x80: 0x20ac,
0x82: 0x201a, 0x82: 0x201a,
0x83: 0x0192, 0x83: 0x0192,

View File

@ -51,7 +51,7 @@ import {
import { startMeasure, endMeasure } from './profiling' import { startMeasure, endMeasure } from './profiling'
import { componentAdded } from './devtools' import { componentAdded } from './devtools'
export type Data = { [key: string]: unknown } export type Data = Record<string, unknown>
// Note: can't mark this whole interface internal because some public interfaces // Note: can't mark this whole interface internal because some public interfaces
// extend it. // extend it.

View File

@ -80,7 +80,7 @@ type InferPropType<T> = T extends null
: T extends { type: null | true } : T extends { type: null | true }
? any // As TS issue https://github.com/Microsoft/TypeScript/issues/14829 // somehow `ObjectConstructor` when inferred from { (): T } becomes `any` // `BooleanConstructor` when inferred from PropConstructor(with PropMethod) becomes `Boolean` ? any // As TS issue https://github.com/Microsoft/TypeScript/issues/14829 // somehow `ObjectConstructor` when inferred from { (): T } becomes `any` // `BooleanConstructor` when inferred from PropConstructor(with PropMethod) becomes `Boolean`
: T extends ObjectConstructor | { type: ObjectConstructor } : T extends ObjectConstructor | { type: ObjectConstructor }
? { [key: string]: any } ? Record<string, any>
: T extends BooleanConstructor | { type: BooleanConstructor } : T extends BooleanConstructor | { type: BooleanConstructor }
? boolean ? boolean
: T extends Prop<infer V> ? V : T : T extends Prop<infer V> ? V : T

View File

@ -6,7 +6,7 @@ export interface AppRecord {
id: number id: number
app: App app: App
version: string version: string
types: { [key: string]: string | Symbol } types: Record<string, string | Symbol>
} }
enum DevtoolsHooks { enum DevtoolsHooks {

View File

@ -214,7 +214,7 @@ export function setBlockTracking(value: number) {
*/ */
export function createBlock( export function createBlock(
type: VNodeTypes | ClassComponent, type: VNodeTypes | ClassComponent,
props?: { [key: string]: any } | null, props?: Record<string, any> | null,
children?: any, children?: any,
patchFlag?: number, patchFlag?: number,
dynamicProps?: string[] dynamicProps?: string[]