313 lines
6.9 KiB
Plaintext
313 lines
6.9 KiB
Plaintext
exports[`test FormData.js 1`] = `
|
|
"/* @flow */
|
|
|
|
// constructor
|
|
const a: FormData = new FormData(); // correct
|
|
new FormData(\'\'); // incorrect
|
|
new FormData(document.createElement(\'input\')); // incorrect
|
|
new FormData(document.createElement(\'form\')); // correct
|
|
|
|
// has
|
|
const b: boolean = a.has(\'foo\'); // correct
|
|
|
|
// get
|
|
const c: ?(string | File) = a.get(\'foo\'); // correct
|
|
const d: string = a.get(\'foo\'); // incorrect
|
|
const e: Blob = a.get(\'foo\'); // incorrect
|
|
const f: ?(string | File | Blob) = a.get(\'foo\'); // incorrect
|
|
a.get(2); // incorrect
|
|
|
|
// getAll
|
|
const a1: Array<string | File> = a.getAll(\'foo\'); // correct
|
|
const a2: Array<string | File | number> = a.getAll(\'foo\'); // incorrect
|
|
const a3: Array<string | Blob | File> = a.getAll(\'foo\'); // incorrect
|
|
a.getAll(23); // incorrect
|
|
|
|
// set
|
|
a.set(\'foo\', \'bar\'); // correct
|
|
a.set(\'foo\', {}); // incorrect
|
|
a.set(2, \'bar\'); // incorrect
|
|
a.set(\'foo\', \'bar\', \'baz\'); // incorrect
|
|
a.set(\'bar\', new File([], \'q\')) // correct
|
|
a.set(\'bar\', new File([], \'q\'), \'x\') // correct
|
|
a.set(\'bar\', new File([], \'q\'), 2) // incorrect
|
|
a.set(\'bar\', new Blob) // correct
|
|
a.set(\'bar\', new Blob, \'x\') // correct
|
|
a.set(\'bar\', new Blob, 2) // incorrect
|
|
|
|
// append
|
|
a.append(\'foo\', \'bar\'); // correct
|
|
a.append(\'foo\', {}); // incorrect
|
|
a.append(2, \'bar\'); // incorrect
|
|
a.append(\'foo\', \'bar\', \'baz\'); // incorrect
|
|
a.append(\'foo\', \'bar\'); // incorrect
|
|
a.append(\'bar\', new File([], \'q\')) // correct
|
|
a.append(\'bar\', new File([], \'q\'), \'x\') // correct
|
|
a.append(\'bar\', new File([], \'q\'), 2) // incorrect
|
|
a.append(\'bar\', new Blob) // correct
|
|
a.append(\'bar\', new Blob, \'x\') // correct
|
|
a.append(\'bar\', new Blob, 2) // incorrect
|
|
|
|
// delete
|
|
a.delete(\'xx\'); // correct
|
|
a.delete(3); // incorrect
|
|
|
|
// keys
|
|
for (let x: string of a.keys()) {} // correct
|
|
for (let x: number of a.keys()) {} // incorrect
|
|
|
|
// values
|
|
for (let x: string | File of a.values()) {} // correct
|
|
for (let x: string | File | Blob of a.values()) {} // incorrect
|
|
|
|
// entries
|
|
for (let [x, y]: [string, string | File] of a.entries()) {} // correct
|
|
for (let [x, y]: [string, string | File | Blob] of a.entries()) {} // incorrect
|
|
for (let [x, y]: [number, string] of a.entries()) {} // incorrect
|
|
for (let [x, y]: [string, number] of a.entries()) {} // incorrect
|
|
for (let [x, y]: [number, number] of a.entries()) {} // incorrect
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
/* @flow */
|
|
// constructor
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// correct
|
|
// has
|
|
// correct
|
|
// get
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// getAll
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// set
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// append
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// delete
|
|
// correct
|
|
// incorrect
|
|
// keys
|
|
// correct
|
|
// incorrect
|
|
// values
|
|
// correct
|
|
// incorrect
|
|
// entries
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
const a: FormData = new FormData();
|
|
|
|
new FormData(\"\");
|
|
|
|
new FormData(document.createElement(\"input\"));
|
|
|
|
new FormData(document.createElement(\"form\"));
|
|
const b: boolean = a.has(\"foo\");
|
|
const c: ?(string | File) = a.get(\"foo\");
|
|
const d: string = a.get(\"foo\");
|
|
const e: Blob = a.get(\"foo\");
|
|
const f: ?(string | File | Blob) = a.get(\"foo\");
|
|
|
|
a.get(2);
|
|
const a1: Array<string | File> = a.getAll(\"foo\");
|
|
const a2: Array<string | File | number> = a.getAll(\"foo\");
|
|
const a3: Array<string | Blob | File> = a.getAll(\"foo\");
|
|
|
|
a.getAll(23);
|
|
|
|
a.set(\"foo\", \"bar\");
|
|
|
|
a.set(\"foo\", {});
|
|
|
|
a.set(2, \"bar\");
|
|
|
|
a.set(\"foo\", \"bar\", \"baz\");
|
|
|
|
a.set(\"bar\", new File([], \"q\"));
|
|
|
|
a.set(\"bar\", new File([], \"q\"), \"x\");
|
|
|
|
a.set(\"bar\", new File([], \"q\"), 2);
|
|
|
|
a.set(\"bar\", new Blob());
|
|
|
|
a.set(\"bar\", new Blob(), \"x\");
|
|
|
|
a.set(\"bar\", new Blob(), 2);
|
|
|
|
a.append(\"foo\", \"bar\");
|
|
|
|
a.append(\"foo\", {});
|
|
|
|
a.append(2, \"bar\");
|
|
|
|
a.append(\"foo\", \"bar\", \"baz\");
|
|
|
|
a.append(\"foo\", \"bar\");
|
|
|
|
a.append(\"bar\", new File([], \"q\"));
|
|
|
|
a.append(\"bar\", new File([], \"q\"), \"x\");
|
|
|
|
a.append(\"bar\", new File([], \"q\"), 2);
|
|
|
|
a.append(\"bar\", new Blob());
|
|
|
|
a.append(\"bar\", new Blob(), \"x\");
|
|
|
|
a.append(\"bar\", new Blob(), 2);
|
|
|
|
a.delete(\"xx\");
|
|
|
|
a.delete(3);
|
|
|
|
for (let x: string of a.keys())
|
|
{}
|
|
|
|
for (let x: number of a.keys())
|
|
{}
|
|
|
|
for (let x: string | File of a.values())
|
|
{}
|
|
|
|
for (let x: string | File | Blob of a.values())
|
|
{}
|
|
|
|
for (let [ x, y ]: [string, string | File] of a.entries())
|
|
{}
|
|
|
|
for (let [ x, y ]: [string, string | File | Blob] of a.entries())
|
|
{}
|
|
|
|
for (let [ x, y ]: [number, string] of a.entries())
|
|
{}
|
|
|
|
for (let [ x, y ]: [string, number] of a.entries())
|
|
{}
|
|
|
|
for (let [ x, y ]: [number, number] of a.entries())
|
|
{}
|
|
"
|
|
`;
|
|
|
|
exports[`test MutationObserver.js 1`] = `
|
|
"/* @flow */
|
|
|
|
// constructor
|
|
function callback(arr: Array<MutationRecord>, observer: MutationObserver): void {
|
|
return;
|
|
}
|
|
const o: MutationObserver = new MutationObserver(callback); // correct
|
|
new MutationObserver((arr: Array<MutationRecord>) => true); // correct
|
|
new MutationObserver(() => {}); // correct
|
|
new MutationObserver(); // incorrect
|
|
new MutationObserver(42); // incorrect
|
|
new MutationObserver((n: number) => {}); // incorrect
|
|
|
|
// observe
|
|
const div = document.createElement(\'div\');
|
|
o.observe(div, { attributes: true, attributeFilter: [\'style\'] }); // correct
|
|
o.observe(div, { characterData: true, invalid: true }); // correct
|
|
o.observe(); // incorrect
|
|
o.observe(\'invalid\'); // incorrect
|
|
o.observe(div); // incorrect
|
|
o.observe(div, {}); // incorrect
|
|
o.observe(div, { subtree: true }); // incorrect
|
|
o.observe(div, { attributes: true, attributeFilter: true }); // incorrect
|
|
|
|
// takeRecords
|
|
o.takeRecords(); // correct
|
|
|
|
// disconnect
|
|
o.disconnect(); // correct
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
/* @flow */
|
|
// constructor
|
|
// correct
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// observe
|
|
// correct
|
|
// correct
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// incorrect
|
|
// takeRecords
|
|
// correct
|
|
// disconnect
|
|
// correct
|
|
function callback(
|
|
arr: Array<MutationRecord>, observer: MutationObserver
|
|
): void {
|
|
return;
|
|
}
|
|
const o: MutationObserver = new MutationObserver(callback);
|
|
|
|
new MutationObserver((arr: Array<MutationRecord>) => true);
|
|
|
|
new MutationObserver(() => {});
|
|
|
|
new MutationObserver();
|
|
|
|
new MutationObserver(42);
|
|
|
|
new MutationObserver((n: number) => {});
|
|
const div = document.createElement(\"div\");
|
|
|
|
o.observe(div, { attributes: true, attributeFilter: [ \"style\" ] });
|
|
|
|
o.observe(div, { characterData: true, invalid: true });
|
|
|
|
o.observe();
|
|
|
|
o.observe(\"invalid\");
|
|
|
|
o.observe(div);
|
|
|
|
o.observe(div, {});
|
|
|
|
o.observe(div, { subtree: true });
|
|
|
|
o.observe(div, { attributes: true, attributeFilter: true });
|
|
|
|
o.takeRecords();
|
|
|
|
o.disconnect();
|
|
"
|
|
`;
|