Skip to content

Commit

Permalink
remove unnecessary as const
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasimir committed Sep 6, 2024
1 parent 1d0f293 commit 63b9b01
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const StageEditor = ({
{
num_stages: num_stages,
stage_index: index + 1,
stage_action: 'stage_content_changed' as const,
stage_action: 'stage_content_changed',
stage_name: stageOperator,
editor_view_type: editor_view_type,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const AtlasStagePreview = ({
href={ATLAS_LINK}
target="_blank"
onClick={() => {
track('Atlas Link Clicked', { screen: 'agg_builder' as const });
track('Atlas Link Clicked', { screen: 'agg_builder' });
}}
variant="primary"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export const changeStageOperator = (
'Aggregation Edited',
{
num_stages: pipelineFromStore(stages).length,
stage_action: 'stage_renamed' as const,
stage_action: 'stage_renamed',
stage_name: stage.operator,
stage_index: idxInPipeline + 1,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
Expand Down Expand Up @@ -673,7 +673,7 @@ export const addStage = (
'Aggregation Edited',
{
num_stages: pipelineFromStore(stages).length,
stage_action: 'stage_added' as const,
stage_action: 'stage_added',
stage_index: stage.id + 1,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
},
Expand Down Expand Up @@ -713,7 +713,7 @@ export const removeStage = (
'Aggregation Edited',
{
num_stages: pipelineFromStore(stages).length,
stage_action: 'stage_deleted' as const,
stage_action: 'stage_deleted',
stage_name: stage.operator,
stage_index: idxInPipeline + 1,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
Expand Down Expand Up @@ -774,7 +774,7 @@ export const moveStage = (
'Aggregation Edited',
{
num_stages: pipelineFromStore(stages).length,
stage_action: 'stage_reordered' as const,
stage_action: 'stage_reordered',
stage_name: stageAtFromIdx.stageOperator,
stage_index: stageAtFromIdx.idxInPipeline + 1,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
Expand Down Expand Up @@ -944,7 +944,7 @@ export const convertWizardToStage = (
'Aggregation Edited',
{
num_stages: pipelineFromStore(stages).length + 1,
stage_action: 'stage_added' as const,
stage_action: 'stage_added',
stage_name: stage.operator,
stage_index: afterStageIndex + 1,
editor_view_type: 'stage',
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-aggregations/src/modules/saved-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const confirmOpenPipeline =
{
id: pipelineData.id,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
screen: 'aggregations' as const,
screen: 'aggregations',
},
connectionInfo
);
Expand Down Expand Up @@ -275,7 +275,7 @@ export const confirmDeletePipeline =
{
id: pipelineId,
editor_view_type: mapPipelineModeToEditorViewType(getState()),
screen: 'aggregations' as const,
screen: 'aggregations',
},
connectionInfo
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ export function AtlasHelpSection(): React.ReactElement {
createClusterButtonStyles,
!darkMode && createClusterButtonLightModeStyles
)}
onClick={() =>
track('Atlas Link Clicked', { screen: 'connect' as const })
}
onClick={() => track('Atlas Link Clicked', { screen: 'connect' })}
variant={ButtonVariant.PrimaryOutline}
href="https://www.mongodb.com/cloud/atlas/lp/try4?utm_source=compass&utm_medium=product&utm_content=v1"
target="_blank"
Expand Down
6 changes: 2 additions & 4 deletions packages/compass-import-export/src/modules/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ export const openExport = (
track(
'Export Opened',
{
type: exportOptions.aggregation
? ('aggregation' as const)
: ('query' as const),
type: exportOptions.aggregation ? 'aggregation' : 'query',
origin: exportOptions.origin,
},
connectionRepository.getConnectionInfoById(exportOptions.connectionId)
Expand Down Expand Up @@ -544,7 +542,7 @@ export const runExport = ({
track(
'Export Completed',
{
type: aggregation ? ('aggregation' as const) : ('query' as const),
type: aggregation ? 'aggregation' : 'query',
all_docs: exportFullCollection,
has_projection:
exportFullCollection || aggregation || !_query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const FavoriteItem = ({
'Query History Favorite Used',
{
id: query._id,
screen: 'documents' as const,
screen: 'documents',
isUpdateQuery,
},
connectionInfoAccess.getCurrentConnectionInfo()
Expand Down Expand Up @@ -80,7 +80,7 @@ const FavoriteItem = ({
'Query History Favorite Removed',
{
id: query._id,
screen: 'documents' as const,
screen: 'documents',
isUpdateQuery,
},
connectionInfoAccess.getCurrentConnectionInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const AggregationsQueriesList = ({
useTrackOnChange(
(track: TrackFunction) => {
if (filters.database) {
track('My Queries Filter', { type: 'database' as const });
track('My Queries Filter', { type: 'database' });
}
},
[filters.database]
Expand All @@ -153,7 +153,7 @@ export const AggregationsQueriesList = ({
useTrackOnChange(
(track: TrackFunction) => {
if (filters.collection) {
track('My Queries Filter', { type: 'collection' as const });
track('My Queries Filter', { type: 'collection' });
}
},
[filters.collection]
Expand All @@ -169,10 +169,7 @@ export const AggregationsQueriesList = ({
(track: TrackFunction) => {
track('My Queries Sort', {
sort_by: sortState.name,
order:
sortState.order === 1
? ('ascending' as const)
: ('descending' as const),
order: sortState.order === 1 ? 'ascending' : 'descending',
});
},
[sortState]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function copyToClipboard(
: 'Query History Favorite Copied',
{
id: item.id,
screen: 'my_queries' as const,
screen: 'my_queries',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const confirmDeleteItem = (
: 'Query History Favorite Removed',
{
id: item.id,
screen: 'my_queries' as const,
screen: 'my_queries',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ const openItem =
: 'Query History Favorite Used',
{
id: item.id,
screen: 'my_queries' as const,
screen: 'my_queries',
}
);

Expand Down
4 changes: 1 addition & 3 deletions packages/compass-welcome/src/components/welcome-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ function AtlasHelpSection(): React.ReactElement {
createClusterButtonStyles,
!darkMode && createClusterButtonLightModeStyles
)}
onClick={() =>
track('Atlas Link Clicked', { screen: 'connect' as const })
}
onClick={() => track('Atlas Link Clicked', { screen: 'connect' })}
variant={ButtonVariant.PrimaryOutline}
href="https://www.mongodb.com/cloud/atlas/lp/try4?utm_source=compass&utm_medium=product&utm_content=v1"
target="_blank"
Expand Down
14 changes: 7 additions & 7 deletions packages/compass/src/main/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ const track = createIpcTrack();
type ExitHandler = () => Promise<unknown>;
type CompassApplicationMode = 'CLI' | 'GUI';

const getContext = () => {
const getContext = (): 'terminal' | 'desktop_app' => {
return process.stdin.isTTY || process.stdout.isTTY || process.stderr.isTTY
? ('terminal' as const)
: ('desktop_app' as const);
? 'terminal'
: 'desktop_app';
};

const getLaunchConnectionSource = (
file?: string,
positionalArguments?: string[]
) => {
if (file) return 'JSON_file' as const;
if (positionalArguments?.length) return 'string' as const;
return 'none' as const;
): 'JSON_file' | 'string' | 'none' => {
if (file) return 'JSON_file';
if (positionalArguments?.length) return 'string';
return 'none';
};

const hasConfig = (
Expand Down

0 comments on commit 63b9b01

Please sign in to comment.