refactor(types): use stricter settings

fix #847
This commit is contained in:
Evan You
2020-03-23 11:08:22 -04:00
parent b3890a93e3
commit b8c1be18f3
27 changed files with 385 additions and 381 deletions

View File

@@ -11,11 +11,11 @@ import { isArray, looseEqual, looseIndexOf } from '@vue/shared'
const getModelAssigner = (vnode: VNode): ((value: any) => void) =>
vnode.props!['onUpdate:modelValue']
function onCompositionStart(e: CompositionEvent) {
function onCompositionStart(e: Event) {
;(e.target as any).composing = true
}
function onCompositionEnd(e: CompositionEvent) {
function onCompositionEnd(e: Event) {
const target = e.target as any
if (target.composing) {
target.composing = false

View File

@@ -6,7 +6,7 @@ type KeyedEvent = KeyboardEvent | MouseEvent | TouchEvent
const modifierGuards: Record<
string,
(e: Event, modifiers?: string[]) => void | boolean
(e: Event, modifiers: string[]) => void | boolean
> = {
stop: e => e.stopPropagation(),
prevent: e => e.preventDefault(),
@@ -18,7 +18,7 @@ const modifierGuards: Record<
left: e => 'button' in e && (e as MouseEvent).button !== 0,
middle: e => 'button' in e && (e as MouseEvent).button !== 1,
right: e => 'button' in e && (e as MouseEvent).button !== 2,
exact: (e, modifiers: string[]) =>
exact: (e, modifiers) =>
systemModifiers.some(m => (e as any)[`${m}Key`] && !modifiers.includes(m))
}