Page type-check: strict throughout, a typed $, null checks (#236)
$<T> returns the element type it is given and assumes the element is there: 122 lookups take their type from the tag their id is on in the markup. A handler reads its target through a cast, since a typed element will not take a handler whose event names a narrower target. strictNullChecks found no bug the page had; its 94 places were values the code already handles in ways the type-check could not follow (data- attributes the page writes, a map entry set the line before, Share drawn only for an item with a link), each now said so. isPlayable stays a plain boolean: as a type guard its false would have meant "no file", and it is also false for a file that is not audio or video. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,14 +5,9 @@
|
||||
"target": "es2022",
|
||||
"lib": ["es2022", "dom", "dom.iterable"],
|
||||
"noEmit": true,
|
||||
// strict, a flag at a time (#235); strictNullChecks still to come, with a typed $ (#236).
|
||||
"strict": false,
|
||||
"noImplicitAny": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
// Strict throughout (#235, #236). $ assumes the element is there: the page check proves the
|
||||
// ones wired at load exist, and a lookup that may find nothing says so with ?.
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["web/src/*.ts"]
|
||||
|
||||
Reference in New Issue
Block a user