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

@ -267,7 +267,7 @@ describe('compiler: transform', () => {
}
}
test('no chidlren', () => {
test('no children', () => {
const ast = transformWithCodegen(``)
expect(ast.codegenNode).toBeUndefined()
})

View File

@ -50,7 +50,7 @@ function parseWithElementTransform(
}
describe('compiler: element transform', () => {
test('import + resovle component', () => {
test('import + resolve component', () => {
const { root } = parseWithElementTransform(`<Foo/>`)
expect(root.imports).toContain(RESOLVE_COMPONENT)
expect(root.statements[0]).toMatch(`${RESOLVE_COMPONENT}("Foo")`)
@ -575,7 +575,7 @@ describe('compiler: element transform', () => {
expect(node2.arguments.length).toBe(4)
expect(node2.arguments[3]).toBe(`${PatchFlags.TEXT} /* TEXT */`)
// multiple nodes, merged with optimze text
// multiple nodes, merged with optimize text
const { node: node3 } = parseWithBind(`<div>foo {{ bar }} baz</div>`)
expect(node3.arguments.length).toBe(4)
expect(node3.arguments[3]).toBe(`${PatchFlags.TEXT} /* TEXT */`)

View File

@ -264,7 +264,7 @@ describe('reactivity/readonly', () => {
})
if (Collection === Map) {
test('should retrive readonly values on iteration', () => {
test('should retrieve readonly values on iteration', () => {
const key1 = {}
const key2 = {}
const original = new Collection([[key1, {}], [key2, {}]])
@ -334,7 +334,7 @@ describe('reactivity/readonly', () => {
})
if (Collection === Set) {
test('should retrive readonly values on iteration', () => {
test('should retrieve readonly values on iteration', () => {
const original = new Collection([{}, {}])
const observed: any = readonly(original)
for (const value of observed) {

View File

@ -13,7 +13,7 @@ import {
describe('error handling', () => {
mockWarn()
test('propagtaion', () => {
test('propagation', () => {
const err = new Error('foo')
const fn = jest.fn()
@ -365,8 +365,8 @@ describe('error handling', () => {
const onError = jest.spyOn(console, 'error')
onError.mockImplementation(() => {})
const groupCollpased = jest.spyOn(console, 'groupCollapsed')
groupCollpased.mockImplementation(() => {})
const groupCollapsed = jest.spyOn(console, 'groupCollapsed')
groupCollapsed.mockImplementation(() => {})
const log = jest.spyOn(console, 'log')
log.mockImplementation(() => {})
@ -397,7 +397,7 @@ describe('error handling', () => {
expect(onError).toHaveBeenCalledWith(err)
onError.mockRestore()
groupCollpased.mockRestore()
groupCollapsed.mockRestore()
log.mockRestore()
process.env.NODE_ENV = 'test'
})

View File

@ -285,7 +285,7 @@ describe('renderer: suspense', () => {
expect(serializeInner(root)).toBe(`<div>fallback</div>`)
expect(calls).toEqual([])
// remvoe the async dep before it's resolved
// remove the async dep before it's resolved
toggle.value = false
await nextTick()
// should cause the suspense to resolve immediately

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[] {