chore: fix typos (#103)

This commit is contained in:
Vladimir
2019-10-05 21:48:54 +07:00
committed by Evan You
parent ec8f7c6375
commit f48a2ffc76
10 changed files with 26 additions and 26 deletions

View File

@@ -168,7 +168,7 @@ export interface LegacyOptions<
beforeUpdate?(): void
updated?(): void
activated?(): void
decativated?(): void
deactivated?(): void
beforeUnmount?(): void
unmounted?(): void
renderTracked?(e: DebuggerEvent): void
@@ -206,7 +206,7 @@ export function applyOptions(
beforeUpdate,
updated,
// TODO activated
// TODO decativated
// TODO deactivated
beforeUnmount,
unmounted,
renderTracked,

View File

@@ -33,36 +33,36 @@ export type PropType<T> = PropConstructor<T> | PropConstructor<T>[]
type PropConstructor<T> = { new (...args: any[]): T & object } | { (): T }
type RequiredKeys<T, MakeDefautRequired> = {
type RequiredKeys<T, MakeDefaultRequired> = {
[K in keyof T]: T[K] extends
| { required: true }
| (MakeDefautRequired extends true ? { default: any } : never)
| (MakeDefaultRequired extends true ? { default: any } : never)
? K
: never
}[keyof T]
type OptionalKeys<T, MakeDefautRequired> = Exclude<
type OptionalKeys<T, MakeDefaultRequired> = Exclude<
keyof T,
RequiredKeys<T, MakeDefautRequired>
RequiredKeys<T, MakeDefaultRequired>
>
type InferPropType<T> = T extends null
? any // null & true would fail to infer
: T extends { type: null | true }
? any // somehow `ObjectContructor` when inferred from { (): T } becomes `any`
? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
: T extends ObjectConstructor | { type: ObjectConstructor }
? { [key: string]: any }
: T extends Prop<infer V> ? V : T
export type ExtractPropTypes<
O,
MakeDefautRequired extends boolean = true
MakeDefaultRequired extends boolean = true
> = O extends object
? {
readonly [K in RequiredKeys<O, MakeDefautRequired>]: InferPropType<O[K]>
readonly [K in RequiredKeys<O, MakeDefaultRequired>]: InferPropType<O[K]>
} &
{
readonly [K in OptionalKeys<O, MakeDefautRequired>]?: InferPropType<
readonly [K in OptionalKeys<O, MakeDefaultRequired>]?: InferPropType<
O[K]
>
}

View File

@@ -13,7 +13,7 @@ export function renderSlot(
name: string,
props: any = {},
// this is not a user-facing function, so the fallback is always generated by
// the compiler and gurunteed to be an array
// the compiler and guaranteed to be an array
fallback?: VNodeChildren
): VNode {
const slot = slots[name]

View File

@@ -1,6 +1,6 @@
import { isArray, isPlainObject, objectToString } from '@vue/shared'
// for conversting {{ interpolation }} values to displayed strings.
// for converting {{ interpolation }} values to displayed strings.
export function toString(val: any): string {
return val == null
? ''

View File

@@ -65,14 +65,14 @@ function getComponentTrace(): ComponentTraceStack {
// we can't just use the stack because it will be incomplete during updates
// that did not start from the root. Re-construct the parent chain using
// instance parent pointers.
const normalizeStack: ComponentTraceStack = []
const normalizedStack: ComponentTraceStack = []
while (currentVNode) {
const last = normalizeStack[0]
const last = normalizedStack[0]
if (last && last.vnode === currentVNode) {
last.recurseCount++
} else {
normalizeStack.push({
normalizedStack.push({
vnode: currentVNode,
recurseCount: 0
})
@@ -82,7 +82,7 @@ function getComponentTrace(): ComponentTraceStack {
currentVNode = parentInstance && parentInstance.vnode
}
return normalizeStack
return normalizedStack
}
function formatTrace(trace: ComponentTraceStack): string[] {