diff --git a/packages/compass-aggregations/src/components/stage-editor/stage-editor.tsx b/packages/compass-aggregations/src/components/stage-editor/stage-editor.tsx index 3320c00ad14..1c4745e5493 100644 --- a/packages/compass-aggregations/src/components/stage-editor/stage-editor.tsx +++ b/packages/compass-aggregations/src/components/stage-editor/stage-editor.tsx @@ -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, }, diff --git a/packages/compass-aggregations/src/components/stage-preview/atlas-stage-preview.tsx b/packages/compass-aggregations/src/components/stage-preview/atlas-stage-preview.tsx index 4545195e1b0..82004049012 100644 --- a/packages/compass-aggregations/src/components/stage-preview/atlas-stage-preview.tsx +++ b/packages/compass-aggregations/src/components/stage-preview/atlas-stage-preview.tsx @@ -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" > diff --git a/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts b/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts index e776ddbdf18..54e84593e16 100644 --- a/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts +++ b/packages/compass-aggregations/src/modules/pipeline-builder/stage-editor.ts @@ -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()), @@ -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()), }, @@ -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()), @@ -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()), @@ -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', diff --git a/packages/compass-aggregations/src/modules/saved-pipeline.ts b/packages/compass-aggregations/src/modules/saved-pipeline.ts index 0f1b4d9643d..0fccaa96060 100644 --- a/packages/compass-aggregations/src/modules/saved-pipeline.ts +++ b/packages/compass-aggregations/src/modules/saved-pipeline.ts @@ -244,7 +244,7 @@ export const confirmOpenPipeline = { id: pipelineData.id, editor_view_type: mapPipelineModeToEditorViewType(getState()), - screen: 'aggregations' as const, + screen: 'aggregations', }, connectionInfo ); @@ -275,7 +275,7 @@ export const confirmDeletePipeline = { id: pipelineId, editor_view_type: mapPipelineModeToEditorViewType(getState()), - screen: 'aggregations' as const, + screen: 'aggregations', }, connectionInfo ); diff --git a/packages/compass-connections/src/components/atlas-help/atlas-help.tsx b/packages/compass-connections/src/components/atlas-help/atlas-help.tsx index 86988b3c50d..5c265e0f095 100644 --- a/packages/compass-connections/src/components/atlas-help/atlas-help.tsx +++ b/packages/compass-connections/src/components/atlas-help/atlas-help.tsx @@ -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" diff --git a/packages/compass-import-export/src/modules/export.ts b/packages/compass-import-export/src/modules/export.ts index b87a8c23877..6b8415b6e90 100644 --- a/packages/compass-import-export/src/modules/export.ts +++ b/packages/compass-import-export/src/modules/export.ts @@ -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) @@ -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 diff --git a/packages/compass-query-bar/src/components/query-history/favorite-list.tsx b/packages/compass-query-bar/src/components/query-history/favorite-list.tsx index eb74002144e..eeada773310 100644 --- a/packages/compass-query-bar/src/components/query-history/favorite-list.tsx +++ b/packages/compass-query-bar/src/components/query-history/favorite-list.tsx @@ -49,7 +49,7 @@ const FavoriteItem = ({ 'Query History Favorite Used', { id: query._id, - screen: 'documents' as const, + screen: 'documents', isUpdateQuery, }, connectionInfoAccess.getCurrentConnectionInfo() @@ -80,7 +80,7 @@ const FavoriteItem = ({ 'Query History Favorite Removed', { id: query._id, - screen: 'documents' as const, + screen: 'documents', isUpdateQuery, }, connectionInfoAccess.getCurrentConnectionInfo() diff --git a/packages/compass-saved-aggregations-queries/src/components/aggregations-queries-list.tsx b/packages/compass-saved-aggregations-queries/src/components/aggregations-queries-list.tsx index dc34d32e039..3a3114b6b32 100644 --- a/packages/compass-saved-aggregations-queries/src/components/aggregations-queries-list.tsx +++ b/packages/compass-saved-aggregations-queries/src/components/aggregations-queries-list.tsx @@ -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] @@ -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] @@ -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] diff --git a/packages/compass-saved-aggregations-queries/src/stores/copy-to-clipboard.ts b/packages/compass-saved-aggregations-queries/src/stores/copy-to-clipboard.ts index 54b8c910c1f..149a12e4a6c 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/copy-to-clipboard.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/copy-to-clipboard.ts @@ -38,7 +38,7 @@ export function copyToClipboard( : 'Query History Favorite Copied', { id: item.id, - screen: 'my_queries' as const, + screen: 'my_queries', } ); diff --git a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts index 4c0471a9ae3..8b5f6219cac 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts @@ -50,7 +50,7 @@ export const confirmDeleteItem = ( : 'Query History Favorite Removed', { id: item.id, - screen: 'my_queries' as const, + screen: 'my_queries', } ); diff --git a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts index 277520e6480..6820b7b09e4 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts @@ -433,7 +433,7 @@ const openItem = : 'Query History Favorite Used', { id: item.id, - screen: 'my_queries' as const, + screen: 'my_queries', } ); diff --git a/packages/compass-welcome/src/components/welcome-tab.tsx b/packages/compass-welcome/src/components/welcome-tab.tsx index 28331d6f617..96c995ff6ee 100644 --- a/packages/compass-welcome/src/components/welcome-tab.tsx +++ b/packages/compass-welcome/src/components/welcome-tab.tsx @@ -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" diff --git a/packages/compass/src/main/application.ts b/packages/compass/src/main/application.ts index cae6bd1b8cd..bc1297caf85 100644 --- a/packages/compass/src/main/application.ts +++ b/packages/compass/src/main/application.ts @@ -46,19 +46,19 @@ const track = createIpcTrack(); type ExitHandler = () => Promise; 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 = (