Skip to content

Commit

Permalink
update typescript and lib to 2023 (#8022)
Browse files Browse the repository at this point in the history
* update typescript and lib to 2023

* fix type check

* make key thing uniform

* fix types

* fix types some more

---------

Co-authored-by: jackkav <jackkav@gmail.com>
  • Loading branch information
gatzjames and jackkav authored Sep 27, 2024
1 parent 6188f07 commit 873721c
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 34 deletions.
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"eslint-plugin-simple-import-sort": "^12.0.0",
"tslib": "2.0.1",
"type-fest": "^4.15.0",
"typescript": "^5.4.4",
"typescript": "^5.6.2",
"vitest": "^2.0.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/insomnia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"tailwindcss": "^3.4.3",
"tinykeys": "^2.1.0",
"type-fest": "^4.15.0",
"typescript": "^5.4.4",
"typescript": "^5.6.2",
"vite": "^5.2.8",
"vkbeautify": "^0.99.3",
"ws": "^8.17.1",
Expand Down
26 changes: 9 additions & 17 deletions packages/insomnia/src/ui/components/environment-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ export const EnvironmentPicker = ({

return match;
}}
onSelectionChange={environmentId => {
if (environmentId === 'all' || environmentId === null) {
onSelectionChange={key => {
if (key === 'all' || !key) {
return;
}

setActiveGlobalEnvironmentFetcher.submit(
{
environmentId,
environmentId: key.toString(),
},
{
method: 'POST',
Expand Down Expand Up @@ -168,15 +168,11 @@ export const EnvironmentPicker = ({
key={activeGlobalEnvironment?._id}
items={globalEnvironmentList}
selectedKeys={[activeGlobalEnvironment?._id || activeGlobalBaseEnvironment?._id || '']}
onSelectionChange={selection => {
if (selection === 'all' || selection === null) {
return;
}
const environmentId = selection.values().next().value;

if (environmentId === null) {
onSelectionChange={keys => {
if (keys === 'all' || !keys) {
return;
}
const [environmentId] = keys.values();

setActiveGlobalEnvironmentFetcher.submit(
{
Expand Down Expand Up @@ -238,15 +234,11 @@ export const EnvironmentPicker = ({
items={collectionEnvironmentList}
selectedKeys={[activeEnvironment._id || baseEnvironment._id || '']}
disallowEmptySelection
onSelectionChange={selection => {
if (selection === 'all' || selection === null) {
return;
}
const environmentId = selection.values().next().value;

if (environmentId === null) {
onSelectionChange={keys => {
if (keys === 'all' || !keys) {
return;
}
const [environmentId] = keys.values();

setActiveEnvironmentFetcher.submit(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ export const WorkspaceEnvironmentsEditModal = ({ onClose }: {
dragAndDropHooks={environmentsDragAndDrop.dragAndDropHooks}
onSelectionChange={keys => {
if (keys !== 'all') {
setSelectedEnvironmentId(keys.values().next().value);
const [environmentId] = keys.values();
setSelectedEnvironmentId(environmentId.toString());
}
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export const TagEditor: FC<Props> = props => {
if (event.currentTarget.type === 'number') {
return updateArg(parseFloat(event.currentTarget.value), argIndex);
} else if (event.currentTarget.type === 'checkbox') {
// @ts-expect-error -- TSCONVERSION .checked doesn't exist on HTMLSelectElement
return updateArg(event.currentTarget.checked, argIndex);
} else {
return updateArg(event.currentTarget.value, argIndex);
Expand Down
3 changes: 2 additions & 1 deletion packages/insomnia/src/ui/routes/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ export const Debug: FC = () => {
getItems: keys =>
[...keys].map(key => ({ 'text/plain': key.toString() })),
onReorder(event) {
const id = event.keys.values().next().value.toString();
const [firstKey] = event.keys.values();
const id = firstKey.toString();
const targetId = event.target.key.toString();

const dropItem = collection.find(r => r.doc._id === id);
Expand Down
3 changes: 2 additions & 1 deletion packages/insomnia/src/ui/routes/environments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ const Environments = () => {
dragAndDropHooks={environmentsDragAndDrop.dragAndDropHooks}
onSelectionChange={keys => {
if (keys !== 'all') {
setSelectedEnvironmentId(keys.values().next().value);
const [environmentId] = keys.values();
setSelectedEnvironmentId(environmentId.toString());
}
}}
>
Expand Down
9 changes: 5 additions & 4 deletions packages/insomnia/src/ui/routes/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1076,9 +1076,10 @@ const ProjectRoute: FC = () => {
selectionMode="single"
onSelectionChange={keys => {
if (keys !== 'all') {
const value = keys.values().next().value;
nextProjectId.current = value;
const [value] = keys.values();
nextProjectId.current = value.toString();
startSwitchProjectTime.current = performance.now();

navigate({
pathname: `/organization/${organizationId}/project/${value}`,
});
Expand Down Expand Up @@ -1132,9 +1133,9 @@ const ProjectRoute: FC = () => {
selectionMode="single"
onSelectionChange={keys => {
if (keys !== 'all') {
const value = keys.values().next().value;
const [value] = keys.values();

setWorkspaceListScope(value);
setWorkspaceListScope(value.toString());
}
}}
>
Expand Down
4 changes: 2 additions & 2 deletions packages/insomnia/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* Basic */
"esModuleInterop": true,
"skipLibCheck": true,
"target": "es2022",
"target": "es2020",
"allowJs": true,
"resolveJsonModule": true,
"moduleResolution": "node",
Expand All @@ -13,7 +13,7 @@
"sourceMap": true,
/* Runs in the DOM */
"lib": [
"ES2020",
"ES2023",
"DOM.Iterable",
"DOM"
],
Expand Down

0 comments on commit 873721c

Please sign in to comment.