Skip to content

Commit 47d7a7f

Browse files
authored
Enable strict null checks (#80)
* Enable strict null checks * Fix type errors
1 parent 31151c5 commit 47d7a7f

File tree

9 files changed

+15
-11
lines changed

9 files changed

+15
-11
lines changed

src/arc-layer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const ourDefaultProps = {
9696
_validate: true,
9797
};
9898

99+
// @ts-expect-error Type error in merging default props with ours
99100
const defaultProps: DefaultProps<GeoArrowArcLayerProps> = {
100101
..._defaultProps,
101102
...ourDefaultProps,

src/column-layer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const ourDefaultProps = {
8989
_validate: true,
9090
};
9191

92+
// @ts-expect-error Type error in merging default props with ours
9293
const defaultProps: DefaultProps<GeoArrowColumnLayerProps> = {
9394
..._defaultProps,
9495
...ourDefaultProps,

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ export enum EXTENSION_NAME {
99
MULTILINESTRING = "geoarrow.multilinestring",
1010
MULTIPOLYGON = "geoarrow.multipolygon",
1111
}
12+
13+
export const DEFAULT_COLOR: [number, number, number, number] = [0, 0, 0, 255];

src/heatmap-layer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const ourDefaultProps = {
6464
_validate: true,
6565
};
6666

67+
// @ts-expect-error Type error in merging default props with ours
6768
const defaultProps: DefaultProps<GeoArrowHeatmapLayerProps> = {
6869
..._defaultProps,
6970
...ourDefaultProps,

src/scatterplot-layer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const ourDefaultProps = {
7979
_validate: true,
8080
};
8181

82+
// @ts-expect-error Type error in merging default props with ours
8283
const defaultProps: DefaultProps<GeoArrowScatterplotLayerProps> = {
8384
..._upstreamDefaultProps,
8485
...ourDefaultProps,

src/solid-polygon-layer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from "./utils.js";
2222
import { getPickingInfo } from "./picking.js";
2323
import { ColorAccessor, FloatAccessor, GeoArrowPickingInfo } from "./types.js";
24-
import { EXTENSION_NAME } from "./constants.js";
24+
import { DEFAULT_COLOR, EXTENSION_NAME } from "./constants.js";
2525
import { validateAccessors } from "./validate.js";
2626

2727
/** All properties supported by GeoArrowSolidPolygonLayer */
@@ -80,6 +80,7 @@ const ourDefaultProps: Pick<
8080
_validate: true,
8181
};
8282

83+
// @ts-expect-error Type error in merging default props with ours
8384
const defaultProps: DefaultProps<GeoArrowSolidPolygonLayerProps> = {
8485
..._defaultProps,
8586
...ourDefaultProps,
@@ -312,7 +313,7 @@ function encodePickingColors(
312313
const largestOffset = geomToCoordOffsets[geomToCoordOffsets.length - 1];
313314
const pickingColors = new Uint8ClampedArray(largestOffset);
314315

315-
const pickingColor = [];
316+
const pickingColor: number[] = [];
316317
for (let arrayIdx = 0; arrayIdx < geomToCoordOffsets.length - 1; arrayIdx++) {
317318
const thisOffset = geomToCoordOffsets[arrayIdx];
318319
const nextOffset = geomToCoordOffsets[arrayIdx + 1];

src/utils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function convertStructToFixedSizeList(
9696

9797
type AssignAccessorProps = {
9898
/** The object on which to assign the resolved accesor */
99-
props: object;
99+
props: Record<string, any>;
100100
/** The name of the prop to set */
101101
propName: string;
102102
/** The user-supplied input to the layer. Must either be a scalar value or a reference to a column in the table. */
@@ -136,7 +136,6 @@ export function assignAccessor(args: AssignAccessorProps) {
136136
);
137137
}
138138

139-
// @ts-expect-error Property 'data' does not exist on type 'object'.
140139
props.data.attributes[propName] = {
141140
value: values,
142141
size: columnData.type.listSize,
@@ -152,7 +151,6 @@ export function assignAccessor(args: AssignAccessorProps) {
152151
values = expandArrayToCoords(values, 1, geomCoordOffsets);
153152
}
154153

155-
// @ts-expect-error Property 'data' does not exist on type 'object'.
156154
props.data.attributes[propName] = {
157155
value: values,
158156
size: 1,
@@ -316,8 +314,8 @@ export function extractAccessorsFromProps(
316314
props: Record<string, any>,
317315
excludeKeys: string[],
318316
): [Record<string, any>, Record<string, any>] {
319-
const accessors = {};
320-
const otherProps = {};
317+
const accessors: Record<string, any> = {};
318+
const otherProps: Record<string, any> = {};
321319
for (const [key, value] of Object.entries(props)) {
322320
if (excludeKeys.includes(key)) {
323321
continue;

src/validate.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { assert } from "@deck.gl/core/typed";
22
import * as arrow from "apache-arrow";
3-
import * as ga from "@geoarrow/geoarrow-js";
43

54
export function validateAccessors(
65
props: Record<string, any>,

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"forceConsistentCasingInFileNames": true,
1111
"skipLibCheck": true,
1212
"noEmitOnError": false,
13-
"outDir": "dist"
14-
// "strict": true,
15-
// "strictNullChecks": true,
13+
"outDir": "dist",
14+
"strict": true,
15+
"strictNullChecks": true
1616
// "lib": [
1717
// "es2019.array", "es6", "dom"
1818
// ]

0 commit comments

Comments
 (0)