feat(compiler): ensure interpolation expressions are wrapped with toString()

This commit is contained in:
Evan You
2019-09-23 15:36:30 -04:00
parent e09e887219
commit b3b67b8c7d
23 changed files with 148 additions and 50 deletions

View File

@@ -30,6 +30,13 @@ export const isString = (val: any): val is string => typeof val === 'string'
export const isObject = (val: any): val is Record<any, any> =>
val !== null && typeof val === 'object'
export const objectToString = Object.prototype.toString
export const toTypeString = (value: unknown): string =>
objectToString.call(value)
export const isPlainObject = (val: any): val is object =>
toTypeString(val) === '[object Object]'
const vnodeHooksRE = /^vnode/
export const isReservedProp = (key: string): boolean =>
key === 'key' || key === 'ref' || vnodeHooksRE.test(key)