Skip to content

Commit 80856eb

Browse files
committed
Add strict to tsconfig.json
1 parent d526b6b commit 80856eb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const isElement =
9797
throw new Error('Expected parent node')
9898
}
9999

100-
// @ts-ignore Looks like a node.
100+
// @ts-expect-error Looks like a node.
101101
if (!node || !node.type || typeof node.type !== 'string') {
102102
return false
103103
}
@@ -196,7 +196,7 @@ function tagNameFactory(check) {
196196
return tagName
197197

198198
/**
199-
* @param {Node} node
199+
* @param {unknown} node
200200
* @returns {boolean}
201201
*/
202202
function tagName(node) {
@@ -213,11 +213,12 @@ function castFactory(check) {
213213

214214
/**
215215
* @this {unknown}
216-
* @param {Node} node
216+
* @param {unknown} node
217217
* @param {Array.<unknown>} parameters
218218
* @returns {boolean}
219219
*/
220220
function assertion(node, ...parameters) {
221+
// @ts-expect-error: fine.
221222
return element(node) && Boolean(check.call(this, node, ...parameters))
222223
}
223224
}
@@ -231,9 +232,9 @@ function element(node) {
231232
return Boolean(
232233
node &&
233234
typeof node === 'object' &&
234-
// @ts-ignore Looks like a node.
235+
// @ts-expect-error Looks like a node.
235236
node.type === 'element' &&
236-
// @ts-ignore Looks like an element.
237+
// @ts-expect-error Looks like an element.
237238
typeof node.tagName === 'string'
238239
)
239240
}

test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test('isElement', (t) => {
1212

1313
t.throws(
1414
() => {
15-
// @ts-ignore runtime.
15+
// @ts-expect-error runtime.
1616
isElement(null, true)
1717
},
1818
/Expected function, string, or array as test/,
@@ -178,7 +178,7 @@ test('isElement', (t) => {
178178

179179
st.throws(
180180
() => {
181-
// @ts-ignore runtime.
181+
// @ts-expect-error runtime.
182182
isElement(root.children[0], () => {}, false)
183183
},
184184
/Expected positive finite index for child node/,
@@ -203,7 +203,7 @@ test('isElement', (t) => {
203203

204204
st.throws(
205205
() => {
206-
// @ts-ignore runtime.
206+
// @ts-expect-error runtime.
207207
isElement(root.children[0], () => {}, 0, true)
208208
},
209209
/Expected parent node/,
@@ -212,7 +212,7 @@ test('isElement', (t) => {
212212

213213
st.throws(
214214
() => {
215-
// @ts-ignore runtime.
215+
// @ts-expect-error runtime.
216216
isElement(root.children[0], () => {}, 0, {type: 'root'})
217217
},
218218
/Expected parent node/,

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"declaration": true,
1111
"emitDeclarationOnly": true,
1212
"allowSyntheticDefaultImports": true,
13-
"skipLibCheck": true
13+
"skipLibCheck": true,
14+
"strict": true
1415
}
1516
}

0 commit comments

Comments
 (0)