mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
- An arrow function or method on the right of an untyped `instanceof` has no prototype. Node throws "Function has non-object prototype 'undefined' in instanceof check" for any object, but the runtime threw only for plain objects, arrays and functions, and answered false for typed arrays, native handles, promises and typed references. It now answers false only for primitives. - Coverage lowers the body of a signature-blocked function for its diagnostics. A declared `this` parameter now gives that body its receiver, as lowerFunction does, so `this.label` reports nothing. Before, each use reported SC1080.
13 lines
616 B
TypeScript
13 lines
616 B
TypeScript
// A package's own functions, read off an object the checker cannot type,
|
|
// on the right of `instanceof`: Node walks the value's prototype chain for
|
|
// an ES5 constructor's prototype, at module load and in calls, and throws a
|
|
// TypeError for an arrow function, which has no prototype, when the value
|
|
// is an object.
|
|
import { arrowCheck, arrowObjects, describe, rejects, tags } from "tag-types";
|
|
|
|
console.log(tags());
|
|
console.log(describe("{}"), describe("[1]"), describe("null"), describe('"s"'));
|
|
console.log(rejects('{"tag":"!x"}'));
|
|
console.log(arrowCheck("{}"), arrowCheck("1"));
|
|
console.log(arrowObjects());
|