Skip to content

Commit

Permalink
Add strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 12, 2022
1 parent 3f43be3 commit 47ba6dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
13 changes: 9 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @typedef {import('hast').Element} Element
*/

import fs from 'node:fs'
import https from 'node:https'
import concat from 'concat-stream'
Expand All @@ -7,10 +11,6 @@ import rehypeParse from 'rehype-parse'
import {select, selectAll} from 'hast-util-select'
import {toString} from 'hast-util-to-string'

/**
* @typedef {import('hast').Element} Element
*/

const proc = unified().use(rehypeParse)

https.get('https://microformats.org/wiki/existing-rel-values', onconnection)
Expand Down Expand Up @@ -44,6 +44,11 @@ function onconcat(buf) {
*/
function table(name) {
const node = select('h2:has(#' + name + ') ~ table', tree)

if (!node) {
throw new Error('Missing node for name `' + name + '`')
}

/** @type {Element[]} */
const rows = selectAll('tr', node).slice(1)

Expand Down
18 changes: 10 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"include": ["*.js"],
"include": ["**/**.js"],
"exclude": ["coverage", "node_modules"],
"compilerOptions": {
"target": "ES2020",
"lib": ["ES2020"],
"module": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"checkJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2020"],
"module": "node16",
"newLine": "lf",
"skipLibCheck": true,
"strict": true,
"target": "es2020"
}
}

0 comments on commit 47ba6dd

Please sign in to comment.