Skip to content

Commit 199949d

Browse files
committed
Add strict to tsconfig.json
1 parent e98f8fd commit 199949d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Stringify one point, a position (start and end points), or a node’s
99
* positional information.
1010
*
11-
* @param {NodeLike|Position|Point} [value]
11+
* @param {NodeLike|Position|Point|null} [value]
1212
* @returns {string}
1313
*/
1414
export function stringifyPosition(value) {
@@ -37,23 +37,23 @@ export function stringifyPosition(value) {
3737
}
3838

3939
/**
40-
* @param {Point} point
40+
* @param {Point|undefined} point
4141
* @returns {string}
4242
*/
4343
function point(point) {
4444
return index(point && point.line) + ':' + index(point && point.column)
4545
}
4646

4747
/**
48-
* @param {Position} pos
48+
* @param {Position|undefined} pos
4949
* @returns {string}
5050
*/
5151
function position(pos) {
5252
return point(pos && pos.start) + '-' + point(pos && pos.end)
5353
}
5454

5555
/**
56-
* @param {number} value
56+
* @param {number|undefined} value
5757
* @returns {number}
5858
*/
5959
function index(value) {

test.js

+5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ test('stringifyPosition', function (t) {
5858
stringifyPosition({
5959
type: 'text',
6060
position: {
61+
// @ts-expect-error runtime.
6162
start: {line: null, column: null},
63+
// @ts-expect-error runtime.
6264
end: {line: null, column: null}
6365
}
6466
}),
@@ -79,6 +81,7 @@ test('stringifyPosition', function (t) {
7981
)
8082

8183
t.equal(
84+
// @ts-expect-error runtime.
8285
stringifyPosition({start: null, end: null}),
8386
'1:1-1:1',
8487
'should return a range for a `position` without `point`s'
@@ -99,6 +102,7 @@ test('stringifyPosition', function (t) {
99102
)
100103

101104
t.equal(
105+
// @ts-expect-error runtime.
102106
stringifyPosition({
103107
start: {line: null, column: null},
104108
end: {line: null, column: null}
@@ -117,6 +121,7 @@ test('stringifyPosition', function (t) {
117121
)
118122

119123
t.equal(
124+
// @ts-expect-error runtime.
120125
stringifyPosition({line: null, column: null}),
121126
'1:1',
122127
'should return a point for a `point` without indices'

tsconfig.json

+2-1
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)