Skip to content

Commit

Permalink
chore(types): convert type literals to records (#1615)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavstrelnikov authored Jul 19, 2020
1 parent b8db7ab commit fa5ddf8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-dom/src/decodeHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const decodeHtml: ParserOptions['decodeEntities'] = (
}

// 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,
0x82: 0x201a,
0x83: 0x0192,
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
import { startMeasure, endMeasure } from './profiling'
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
// extend it.
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type InferPropType<T> = T extends null
: 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`
: T extends ObjectConstructor | { type: ObjectConstructor }
? { [key: string]: any }
? Record<string, any>
: T extends BooleanConstructor | { type: BooleanConstructor }
? boolean
: T extends Prop<infer V> ? V : T
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface AppRecord {
id: number
app: App
version: string
types: { [key: string]: string | Symbol }
types: Record<string, string | Symbol>
}

enum DevtoolsHooks {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/vnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export function setBlockTracking(value: number) {
*/
export function createBlock(
type: VNodeTypes | ClassComponent,
props?: { [key: string]: any } | null,
props?: Record<string, any> | null,
children?: any,
patchFlag?: number,
dynamicProps?: string[]
Expand Down

0 comments on commit fa5ddf8

Please sign in to comment.