Skip to content

Commit 6dad8e6

Browse files
build: stricter TS
- Fixed two issues in components
1 parent 4a4e0f5 commit 6dad8e6

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/components/custom-select/custom-select.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const dessertItems: Item[] = [
6868
];
6969

7070
const Component = () => {
71-
const [selectedItem, setSelectedItem] = useState<Item | null>(dessertItems[0]);
71+
const [selectedItem, setSelectedItem] = useState<Item | null>(dessertItems[0] ?? null);
7272

7373
const onChange = useCallback((selectedItem: Item | null) => {
7474
setSelectedItem(selectedItem);

lib/components/custom-select/custom-select.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const CustomSelect = (props: CustomSelectProps) => {
9595

9696
const onValueChange = useCallback(
9797
(e: SelectValueChangeDetails) => {
98-
onChange(e.items.length ? e.items[0] : null);
98+
onChange(e.items[0] ?? null);
9999
},
100100
[onChange]
101101
);

tsconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2020",
3+
"target": "ESNext",
44
"useDefineForClassFields": true,
5-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
5+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
66
"module": "ESNext",
77
"skipLibCheck": true,
88

@@ -19,6 +19,8 @@
1919
"noUnusedLocals": true,
2020
"noUnusedParameters": true,
2121
"noFallthroughCasesInSwitch": true,
22+
"noUncheckedIndexedAccess": true,
23+
"strictNullChecks": true,
2224
},
2325
"include": ["lib"],
2426
"references": [{ "path": "./tsconfig.node.json" }],

0 commit comments

Comments
 (0)