Skip to content

Commit 9ab2edf

Browse files
committed
Add strict to tsconfig.json
1 parent c83d4fc commit 9ab2edf

File tree

2 files changed

+39
-43
lines changed

2 files changed

+39
-43
lines changed

test.js

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,21 @@ test('modifyChildren()', (t) => {
5959
]
6060
let n = -1
6161

62-
modifyChildren(
63-
(
64-
/** @type {ExampleLiteral} */ child,
65-
index,
66-
/** @type {ExampleParent} */ parent
67-
) => {
68-
n++
69-
70-
if (index < 3) {
71-
parent.children.push({type: 'x', value: parent.children.length})
72-
}
73-
74-
st.deepEqual(child, children[n])
75-
st.deepEqual(index, n)
62+
modifyChildren((child, index, parent) => {
63+
n++
64+
65+
if (index < 3) {
66+
parent.children.push(
67+
/** @type {ExampleLiteral} */ ({
68+
type: 'x',
69+
value: parent.children.length
70+
})
71+
)
7672
}
77-
)(
73+
74+
st.deepEqual(child, children[n])
75+
st.deepEqual(index, n)
76+
})(
7877
/** @type {ExampleParent} */ ({
7978
type: 'y',
8079
children: [
@@ -106,20 +105,19 @@ test('modifyChildren()', (t) => {
106105
]
107106
}
108107

109-
modifyChildren(
110-
(
111-
/** @type {ExampleLiteral} */ child,
112-
index,
113-
/** @type {ExampleParent} */ parent
114-
) => {
115-
st.deepEqual(child, children[++n])
116-
117-
if (child.value === 1) {
118-
parent.children.splice(index + 1, 0, {type: 'x', value: 2})
119-
return index + 1
120-
}
108+
modifyChildren((child, index, parent) => {
109+
st.deepEqual(child, children[++n])
110+
111+
// @ts-expect-error: literal.
112+
if (child.value === 1) {
113+
parent.children.splice(
114+
index + 1,
115+
0,
116+
/** @type {ExampleLiteral} */ ({type: 'x', value: 2})
117+
)
118+
return index + 1
121119
}
122-
)(context)
120+
})(context)
123121

124122
st.deepEqual(context.children, children)
125123

@@ -148,21 +146,18 @@ test('modifyChildren()', (t) => {
148146
}
149147
let inserted = false
150148

151-
modifyChildren(
152-
(
153-
/** @type {ExampleLiteral} */ child,
154-
_,
155-
/** @type {ExampleParent} */ parent
156-
) => {
157-
st.deepEqual(child, calls[++n])
158-
159-
if (!inserted && child.value === 1) {
160-
inserted = true
161-
parent.children.unshift({type: 'x', value: -1})
162-
return -1
163-
}
149+
modifyChildren((child, _, parent) => {
150+
st.deepEqual(child, calls[++n])
151+
152+
// @ts-expect-error: literal.
153+
if (!inserted && child.value === 1) {
154+
inserted = true
155+
parent.children.unshift(
156+
/** @type {ExampleLiteral} */ ({type: 'x', value: -1})
157+
)
158+
return -1
164159
}
165-
)(context)
160+
})(context)
166161

167162
st.deepEqual(context.children, [
168163
{type: 'x', value: -1},

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)