chore: run updated prettier

This commit is contained in:
Evan You
2021-07-19 18:24:18 -04:00
parent 69344ff1ae
commit 47f488350c
110 changed files with 695 additions and 698 deletions

View File

@@ -49,7 +49,7 @@ function createArrayInstrumentations() {
// instrument identity-sensitive Array methods to account for possible reactive
// values
;(['includes', 'indexOf', 'lastIndexOf'] as const).forEach(key => {
instrumentations[key] = function(this: unknown[], ...args: unknown[]) {
instrumentations[key] = function (this: unknown[], ...args: unknown[]) {
const arr = toRaw(this) as any
for (let i = 0, l = this.length; i < l; i++) {
track(arr, TrackOpTypes.GET, i + '')
@@ -67,7 +67,7 @@ function createArrayInstrumentations() {
// instrument length-altering mutation methods to avoid length being tracked
// which leads to infinite loops in some cases (#2137)
;(['push', 'pop', 'shift', 'unshift', 'splice'] as const).forEach(key => {
instrumentations[key] = function(this: unknown[], ...args: unknown[]) {
instrumentations[key] = function (this: unknown[], ...args: unknown[]) {
pauseTracking()
const res = (toRaw(this) as any)[key].apply(this, args)
resetTracking()
@@ -91,8 +91,8 @@ function createGetter(isReadonly = false, shallow = false) {
? shallowReadonlyMap
: readonlyMap
: shallow
? shallowReactiveMap
: reactiveMap
? shallowReactiveMap
: reactiveMap
).get(target)
) {
return target

View File

@@ -184,7 +184,7 @@ function createIterableMethod(
isReadonly: boolean,
isShallow: boolean
) {
return function(
return function (
this: IterableCollections,
...args: unknown[]
): Iterable & Iterator {
@@ -224,7 +224,7 @@ function createIterableMethod(
}
function createReadonlyMethod(type: TriggerOpTypes): Function {
return function(this: CollectionTypes, ...args: unknown[]) {
return function (this: CollectionTypes, ...args: unknown[]) {
if (__DEV__) {
const key = args[0] ? `on key "${args[0]}" ` : ``
console.warn(
@@ -242,7 +242,7 @@ function createInstrumentations() {
return get(this, key)
},
get size() {
return size((this as unknown) as IterableCollections)
return size(this as unknown as IterableCollections)
},
has,
add,
@@ -257,7 +257,7 @@ function createInstrumentations() {
return get(this, key, false, true)
},
get size() {
return size((this as unknown) as IterableCollections)
return size(this as unknown as IterableCollections)
},
has,
add,
@@ -272,7 +272,7 @@ function createInstrumentations() {
return get(this, key, true)
},
get size() {
return size((this as unknown) as IterableCollections, true)
return size(this as unknown as IterableCollections, true)
},
has(this: MapTypes, key: unknown) {
return has.call(this, key, true)
@@ -289,7 +289,7 @@ function createInstrumentations() {
return get(this, key, true, true)
},
get size() {
return size((this as unknown) as IterableCollections, true)
return size(this as unknown as IterableCollections, true)
},
has(this: MapTypes, key: unknown) {
return has.call(this, key, true)
@@ -346,8 +346,8 @@ function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
? shallowReadonlyInstrumentations
: shallowInstrumentations
: isReadonly
? readonlyInstrumentations
: mutableInstrumentations
? readonlyInstrumentations
: mutableInstrumentations
return (
target: CollectionTypes,
@@ -384,11 +384,10 @@ export const readonlyCollectionHandlers: ProxyHandler<CollectionTypes> = {
get: /*#__PURE__*/ createInstrumentationGetter(true, false)
}
export const shallowReadonlyCollectionHandlers: ProxyHandler<
CollectionTypes
> = {
get: /*#__PURE__*/ createInstrumentationGetter(true, true)
}
export const shallowReadonlyCollectionHandlers: ProxyHandler<CollectionTypes> =
{
get: /*#__PURE__*/ createInstrumentationGetter(true, true)
}
function checkIdentityKeys(
target: CollectionTypes,

View File

@@ -37,7 +37,7 @@ class ComputedRefImpl<T> {
private _dirty = true
public readonly effect: ReactiveEffect<T>
public readonly __v_isRef = true;
public readonly __v_isRef = true
public readonly [ReactiveFlags.IS_READONLY]: boolean
constructor(

View File

@@ -119,22 +119,22 @@ type Builtin = Primitive | Function | Date | Error | RegExp
export type DeepReadonly<T> = T extends Builtin
? T
: T extends Map<infer K, infer V>
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends ReadonlyMap<infer K, infer V>
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends WeakMap<infer K, infer V>
? WeakMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends Set<infer U>
? ReadonlySet<DeepReadonly<U>>
: T extends ReadonlySet<infer U>
? ReadonlySet<DeepReadonly<U>>
: T extends WeakSet<infer U>
? WeakSet<DeepReadonly<U>>
: T extends Promise<infer U>
? Promise<DeepReadonly<U>>
: T extends {}
? { readonly [K in keyof T]: DeepReadonly<T[K]> }
: Readonly<T>
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends ReadonlyMap<infer K, infer V>
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends WeakMap<infer K, infer V>
? WeakMap<DeepReadonly<K>, DeepReadonly<V>>
: T extends Set<infer U>
? ReadonlySet<DeepReadonly<U>>
: T extends ReadonlySet<infer U>
? ReadonlySet<DeepReadonly<U>>
: T extends WeakSet<infer U>
? WeakSet<DeepReadonly<U>>
: T extends Promise<infer U>
? Promise<DeepReadonly<U>>
: T extends {}
? { readonly [K in keyof T]: DeepReadonly<T[K]> }
: Readonly<T>
/**
* Creates a readonly copy of the original object. Note the returned copy is not

View File

@@ -259,8 +259,10 @@ export type ShallowUnwrapRef<T> = {
[K in keyof T]: T[K] extends Ref<infer V>
? V
: T[K] extends Ref<infer V> | undefined // if `V` is `unknown` that means it does not extend `Ref` and is undefined
? unknown extends V ? undefined : V | undefined
: T[K]
? unknown extends V
? undefined
: V | undefined
: T[K]
}
export type UnwrapRef<T> = T extends Ref<infer V>
@@ -275,8 +277,10 @@ type UnwrapRefSimple<T> = T extends
| RefUnwrapBailTypes[keyof RefUnwrapBailTypes]
? T
: T extends Array<any>
? { [K in keyof T]: UnwrapRefSimple<T[K]> }
: T extends object ? UnwrappedObject<T> : T
? { [K in keyof T]: UnwrapRefSimple<T[K]> }
: T extends object
? UnwrappedObject<T>
: T
// Extract all known symbols from an object
// when unwrapping Object the symbols are not `in keyof`, this should cover all the