Skip to content

Commit d1954a4

Browse files
committed
Change 'any' types to 'unknown'
1 parent 5475ceb commit d1954a4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/vue-vnode-utils.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,35 @@ import {
1818
// @ts-ignore
1919
const DEV = process.env.NODE_ENV !== 'production'
2020

21-
export const isComment = (vnode: any): vnode is (null | undefined | boolean | (VNode & { type: Comment })) => {
21+
export const isComment = (vnode: unknown): vnode is (null | undefined | boolean | (VNode & { type: Comment })) => {
2222
return getType(vnode) === 'comment'
2323
}
2424

25-
export const isComponent = (vnode: any): vnode is (VNode & { type: Component }) => {
25+
export const isComponent = (vnode: unknown): vnode is (VNode & { type: Component }) => {
2626
return getType(vnode) === 'component'
2727
}
2828

29-
export const isElement = (vnode: any): vnode is (VNode & { type: string }) => {
29+
export const isElement = (vnode: unknown): vnode is (VNode & { type: string }) => {
3030
return getType(vnode) === 'element'
3131
}
3232

33-
export const isFragment = (vnode: any): vnode is ((VNode & { type: typeof Fragment }) | VNodeArrayChildren) => {
33+
export const isFragment = (vnode: unknown): vnode is ((VNode & { type: typeof Fragment }) | VNodeArrayChildren) => {
3434
return getType(vnode) === 'fragment'
3535
}
3636

37-
export const isFunctionalComponent = (vnode: any): vnode is (VNode & { type: FunctionalComponent }) => {
37+
export const isFunctionalComponent = (vnode: unknown): vnode is (VNode & { type: FunctionalComponent }) => {
3838
return isComponent(vnode) && typeof vnode.type === 'function'
3939
}
4040

41-
export const isStatefulComponent = (vnode: any): vnode is (VNode & { type: ComponentOptions }) => {
41+
export const isStatefulComponent = (vnode: unknown): vnode is (VNode & { type: ComponentOptions }) => {
4242
return isComponent(vnode) && typeof vnode.type === 'object'
4343
}
4444

45-
export const isStatic = (vnode: any): vnode is (VNode & { type: typeof Static }) => {
45+
export const isStatic = (vnode: unknown): vnode is (VNode & { type: typeof Static }) => {
4646
return getType(vnode) === 'static'
4747
}
4848

49-
export const isText = (vnode: any): vnode is (string | number | (VNode & { type: Text })) => {
49+
export const isText = (vnode: unknown): vnode is (string | number | (VNode & { type: Text })) => {
5050
return getType(vnode) === 'text'
5151
}
5252

@@ -68,7 +68,7 @@ export const getText = (vnode: VNode | string | number): string | undefined => {
6868

6969
type ValueTypes = 'string' | 'number' | 'boolean' | 'undefined' | 'symbol' | 'bigint' | 'object' | 'function' | 'array' | 'date' | 'regexp' | 'vnode' | 'null'
7070

71-
const typeOf = (value: any) => {
71+
const typeOf = (value: unknown) => {
7272
let t: ValueTypes = typeof value
7373

7474
if (t === 'object') {
@@ -103,7 +103,7 @@ const checkArguments = (method: string, passed: unknown[], expected: string[]) =
103103
}
104104
}
105105

106-
export const getType = (vnode: any) => {
106+
export const getType = (vnode: unknown) => {
107107
const typeofVNode = typeof vnode
108108

109109
if (vnode == null || typeofVNode === 'boolean') {
@@ -138,7 +138,7 @@ export const getType = (vnode: any) => {
138138
return undefined
139139
}
140140

141-
const isEmptyObject = (obj: any) => {
141+
const isEmptyObject = (obj: Record<string, unknown>) => {
142142
for (const prop in obj) {
143143
return false
144144
}
@@ -225,7 +225,7 @@ const promoteToVNode = (node: VNode | string | number | boolean | null | undefin
225225

226226
export const addProps = (
227227
children: VNodeArrayChildren,
228-
callback: (vnode: VNode) => (Record<string, any> | null | void),
228+
callback: (vnode: VNode) => (Record<string, unknown> | null | void),
229229
options: IterationOptions = COMPONENTS_AND_ELEMENTS
230230
): VNodeArrayChildren => {
231231
if (DEV) {
@@ -237,7 +237,7 @@ export const addProps = (
237237

238238
const addPropsToChild = (
239239
child: VNodeChild,
240-
callback: (vnode: VNode) => (Record<string, any> | null | void),
240+
callback: (vnode: VNode) => (Record<string, unknown> | null | void),
241241
options: IterationOptions
242242
): VNodeChild => {
243243
if (isFragment(child)) {

0 commit comments

Comments
 (0)