pull/7442/head
Simon Holthausen 3 years ago
parent 3067fe855f
commit 45a3f39d4e

@ -25,7 +25,7 @@ const required1: Action<HTMLElement, boolean> = (node, param) => {
return { return {
update: (p) => p === true, update: (p) => p === true,
destroy: () => {} destroy: () => {}
} };
}; };
required1; required1;
@ -41,7 +41,7 @@ const required3: Action<HTMLElement, boolean> = (node, param) => {
// @ts-expect-error comparison always resolves to false // @ts-expect-error comparison always resolves to false
update: (p) => p === 'd', update: (p) => p === 'd',
destroy: () => {} destroy: () => {}
} };
}; };
required3; required3;
@ -60,7 +60,7 @@ const optional1: Action<HTMLElement, boolean | undefined> = (node, param?) => {
return { return {
update: (p) => p === true, update: (p) => p === true,
destroy: () => {} destroy: () => {}
} };
}; };
optional1; optional1;
@ -82,7 +82,7 @@ const optional4: Action<HTMLElement, boolean | undefined> = (node, param?) => {
// @ts-expect-error comparison always resolves to false // @ts-expect-error comparison always resolves to false
update: (p) => p === 'd', update: (p) => p === 'd',
destroy: () => {} destroy: () => {}
} };
}; };
optional4; optional4;
@ -99,28 +99,31 @@ const no1: Action<HTMLElement, never> = (node) => {
node; node;
return { return {
destroy: () => {} destroy: () => {}
} };
}; };
no1; no1;
// @ts-expect-error param given // @ts-expect-error param given
const no2: Action<HTMLElement, never> = (node, param?) => {} const no2: Action<HTMLElement, never> = (node, param?) => {};
no2;
// @ts-expect-error param given // @ts-expect-error param given
const no3: Action<HTMLElement, never> = (node, param) => {} const no3: Action<HTMLElement, never> = (node, param) => {};
no3;
// @ts-expect-error update method given // @ts-expect-error update method given
const no4: Action<HTMLElement, never> = (node) => { const no4: Action<HTMLElement, never> = (node) => {
return { return {
update: () => {}, update: () => {},
destroy: () => {} destroy: () => {}
} };
} };
no4;
// ---------------- ActionReturn // ---------------- ActionReturn
const requiredReturn: ActionReturn<string> = { const requiredReturn: ActionReturn<string> = {
update: (p) => p.toString(), update: (p) => p.toString()
}; };
requiredReturn; requiredReturn;
@ -129,13 +132,13 @@ const optionalReturn: ActionReturn<boolean | undefined> = {
p === true; p === true;
// @ts-expect-error could be undefined // @ts-expect-error could be undefined
p.toString(); p.toString();
}, }
}; };
optionalReturn; optionalReturn;
const invalidProperty: ActionReturn = { const invalidProperty: ActionReturn = {
// @ts-expect-error invalid property // @ts-expect-error invalid property
invalid: () => {}, invalid: () => {}
}; };
invalidProperty; invalidProperty;
@ -144,5 +147,7 @@ const attributes: Attributes = { a: 'a' };
attributes; attributes;
// @ts-expect-error wrong type // @ts-expect-error wrong type
const invalidAttributes1: Attributes = { a: 1 }; const invalidAttributes1: Attributes = { a: 1 };
invalidAttributes1;
// @ts-expect-error missing prop // @ts-expect-error missing prop
const invalidAttributes2: Attributes = {}; const invalidAttributes2: Attributes = {};
invalidAttributes2;

Loading…
Cancel
Save