Skip to content

Commit

Permalink
fix TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin committed Mar 1, 2024
1 parent 8fb9f62 commit 4fd27fd
Show file tree
Hide file tree
Showing 23 changed files with 49 additions and 173 deletions.
14 changes: 6 additions & 8 deletions app-shell/src/config/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ import {
USB_HTTP_REQUESTS_STOP,
VALUE_UPDATED,
VIEW_PROTOCOL_SOURCE_FOLDER,
NOTIFY_SUBSCRIBE,
NOTIFY_UNSUBSCRIBE,
ROBOT_MASS_STORAGE_DEVICE_ADDED,
ROBOT_MASS_STORAGE_DEVICE_ENUMERATED,
ROBOT_MASS_STORAGE_DEVICE_REMOVED,
UPDATE_BRIGHTNESS,
} from '../constants'
import type {
InitializedAction,
Expand Down Expand Up @@ -102,14 +108,6 @@ import type {
UpdateBrightnessAction,
UsbRequestsAction,
} from '@opentrons/app/src/redux/shell/types'
import type {
NOTIFY_SUBSCRIBE,
NOTIFY_UNSUBSCRIBE,
ROBOT_MASS_STORAGE_DEVICE_ADDED,
ROBOT_MASS_STORAGE_DEVICE_ENUMERATED,
ROBOT_MASS_STORAGE_DEVICE_REMOVED,
UPDATE_BRIGHTNESS,
} from '@opentrons/app/src/redux/shell/actions'

// config file has been initialized
export const configInitialized = (config: Config): ConfigInitializedAction => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export function RobotCoordinateSpace(
...restProps,
}
return animated ? (
// @ts-expect-error Type instantiation is excessively deep and possibly infinite
<AnimatedSvg {...allPassThroughProps}>{children}</AnimatedSvg>
) : (
<Svg {...allPassThroughProps}>{children}</Svg>
Expand All @@ -25,4 +24,5 @@ export function RobotCoordinateSpace(
/**
* These animated components needs to be split out because react-spring and styled-components don't play nice
* @see https://github.com/pmndrs/react-spring/issues/1515 */
// @ts-expect-error Type instantiation is excessively deep and possibly infinite
const AnimatedSvg = styled(animated.svg)<typeof animated.svg>``
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock('../../definitions')
describe('labwareDefToFields', () => {
it('fixture_96_plate', () => {
const def = fixture_96_plate
const result = labwareDefToFields(def)
const result = labwareDefToFields(def as any)
expect(result).toEqual({
labwareType: 'wellPlate',
tubeRackInsertLoadName: null,
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('labwareDefToFields', () => {
it('fixture_12_trough', () => {
// make sure rectangular wells + single row works as expected
const def = fixture_12_trough
const result = labwareDefToFields(def)
const result = labwareDefToFields(def as any)

expect(result?.labwareType).toEqual('reservoir')
expect(result?.gridSpacingY).toBe(null) // single row -> null Y-spacing
Expand All @@ -69,13 +69,13 @@ describe('labwareDefToFields', () => {

it('fixture_irregular_example_1 should return null (until multi-grid labware is supported in LC)', () => {
const def = fixture_irregular_example_1
const result = labwareDefToFields(def)
const result = labwareDefToFields(def as any)
expect(result).toEqual(null)
})

it('fixture_24_tuberack should match snapshot', () => {
const def = fixture_24_tuberack
const result = labwareDefToFields(def)
const result = labwareDefToFields(def as any)

expect(result?.labwareType).toEqual('tubeRack')
expect(result?.brand).toBe('Opentrons')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ describe('load and immediately save integrity test', () => {
// (without these fields, Yup schema cast would fail)
const testCases = [
{
inputDef: fixture_96_plate,
inputDef: fixture_96_plate as LabwareDefinition2,
extraFields: { pipetteName },
},
{
inputDef: fixture_12_trough,
inputDef: fixture_12_trough as LabwareDefinition2,
extraFields: { pipetteName },
},
{
inputDef: fixture_tiprack_300_ul,
inputDef: fixture_tiprack_300_ul as LabwareDefinition2,
extraFields: { pipetteName },
},
{
inputDef: fixture_24_tuberack,
inputDef: fixture_24_tuberack as LabwareDefinition2,
extraFields: { pipetteName, tubeRackInsertLoadName: 'customTubeRack' },
},
]
Expand Down
1 change: 0 additions & 1 deletion protocol-designer/src/components/FilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
InputField,
} from '@opentrons/components'
import { resetScrollElements } from '../ui/steps/utils'
import { Portal } from './portals/MainPageModalPortal'
import { EditModulesCard } from './modules'
import { EditModules } from './EditModules'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { selectors as stepFormSelectors } from '../../step-forms'
import { getRobotType } from '../../file-data/selectors'
import { getAdditionalEquipment } from '../../step-forms/selectors'
import { resetScrollElements } from '../../ui/steps/utils'
import { Portal, getMainPagePortalEl } from '../portals/MainPageModalPortal'
import { getMainPagePortalEl } from '../portals/MainPageModalPortal'
import { useBlockingHint } from '../Hints/useBlockingHint'
import { KnowledgeBaseLink } from '../KnowledgeBaseLink'
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ export function LabwareDetailsCard(): JSX.Element {
{t('generic.nickname')}
</span>
<EditableTextField
value={labwareNicknamesById[labwareId] ?? 'Unnamed Labware'}
value={
labwareId != null && labwareNicknamesById[labwareId] != null
? labwareNicknamesById[labwareId]
: 'Unnamed Labware'
}
saveEdit={renameLabware}
/>
</div>
Expand Down
3 changes: 2 additions & 1 deletion protocol-designer/src/components/LiquidPlacementModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { WellSelectionInstructions } from './WellSelectionInstructions'

import styles from './LiquidPlacementModal.module.css'

export function LiquidPlacementModal(): JSX.Element {
export function LiquidPlacementModal(): JSX.Element | null {
const [highlightedWells, setHighlightedWells] = React.useState<
WellGroup | {}
>({})
Expand All @@ -37,6 +37,7 @@ export function LiquidPlacementModal(): JSX.Element {
false,
'LiquidPlacementModal: No labware is selected, and no labwareId was given to LiquidPlacementModal'
)
return null
}

const labwareDef = labwareEntities[labwareId]?.def
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mockWizardTileProps: Partial<WizardTileProps> = {
goBack: vi.fn(),
proceed: vi.fn(),
watch: vi.fn((name: keyof typeof values) => values[name]) as any,
register: vi.fn(),
register: vi.fn() as any,
formState: {
errors: { fields: { name: null } },
touchedFields: { fields: { name: true } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export function useModalContents(
false,
`invalid messageKey ${uploadResponse.messageKey} specified for modal`
)
// @ts-expect-error (ce, 2021-06-23) the case below will never happened, as we've already narrowed all posibilities
return { title: '', body: uploadResponse.messageKey }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ describe('generateRobotStateTimeline', () => {
)
// NOTE: if you update this snapshot, make sure this it exhibits eager tip dropping
expect(commandOverview).toMatchInlineSnapshot(`
Array [
Array [
[
[
"pickUpTip",
"aspirate",
"dispense",
Expand All @@ -140,14 +140,14 @@ describe('generateRobotStateTimeline', () => {
"moveToAddressableAreaForDropTip",
"dropTipInPlace",
],
Array [
[
"pickUpTip",
"aspirate",
"dispense",
"moveToAddressableAreaForDropTip",
"dropTipInPlace",
],
Array [
[
"pickUpTip",
"aspirate",
"dispense",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export interface GenerateRobotStateTimelineArgs {
export const generateRobotStateTimeline = (
args: GenerateRobotStateTimelineArgs
): StepGeneration.Timeline => {
console.log('got to generateRobotStateTimeline')
const {
allStepArgsAndErrors,
orderedStepIds,
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/tsconfig-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"rootDir": ".",
"outDir": "lib"
},
"include": ["src/**/*.json", "fixtures/**/*.json"],
"include": ["src/**/*.json", "fixtures/**/*.json", "vite.config.ts"],
"exclude": ["**/*.ts", "**/*.tsx"]
}
3 changes: 1 addition & 2 deletions protocol-designer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
},
{
"path": "../step-generation"
},
{ "path": "./tsconfig.node.json" }
}
],
"compilerOptions": {
"rootDir": "src",
Expand Down
9 changes: 0 additions & 9 deletions protocol-designer/tsconfig.node.json

This file was deleted.

12 changes: 6 additions & 6 deletions protocol-designer/typings/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
declare global {
interface Global {
document: {
getElementsByClassName: (val: string) => any[]
}
enablePrereleaseMode: () => void
declare const global: typeof globalThis & {
document: {
getElementsByClassName: (val: string) => any[]
}
enablePrereleaseMode: () => void

}


interface Window {
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (val: string) => any
}
20 changes: 8 additions & 12 deletions step-generation/src/fixtures/commandFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { expect } from 'vitest'
import { tiprackWellNamesFlat } from './data'
import {
tiprackWellNamesFlat,
DEFAULT_PIPETTE,
SOURCE_LABWARE,
AIR_GAP_META,
DEFAULT_BLOWOUT_WELL,
DEST_LABWARE,
} from './data'
import {
AddressableAreaName,
AspDispAirgapParams,
Expand Down Expand Up @@ -89,17 +96,6 @@ export const getFlowRateAndOffsetParamsMix = (): FlowRateAndOffsetParamsMix => (
// for mix only
touchTipMmFromBottom: TOUCH_TIP_OFFSET_FROM_BOTTOM_MM,
})
// =================
export const DEFAULT_PIPETTE = 'p300SingleId'
export const MULTI_PIPETTE = 'p300MultiId'
export const PIPETTE_96 = 'p100096Id'
export const SOURCE_LABWARE = 'sourcePlateId'
export const DEST_LABWARE = 'destPlateId'
export const TROUGH_LABWARE = 'troughId'
export const DEFAULT_BLOWOUT_WELL = 'A1'
export const TIPRACK_1 = 'tiprack1Id'
export const AIR_GAP_META = { isAirGap: true } // to differentiate if the aspirate or dispense command is an air gap or not
// =================
type MakeAspDispHelper<P> = (
bakedParams?: Partial<P>
) => (well: string, volume: number, params?: Partial<P>) => CreateCommand
Expand Down
1 change: 1 addition & 0 deletions step-generation/src/fixtures/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './robotStateFixtures'
export * from './commandFixtures'
export * from './data'
1 change: 1 addition & 0 deletions step-generation/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ export * from './types'
export * from './constants'
export * from './getNextRobotStateAndWarnings'
export * from './fixtures/robotStateFixtures'
export * from './fixtures/data'
2 changes: 2 additions & 0 deletions step-generation/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { reduceCommandCreators } from './reduceCommandCreators'
import { modulePipetteCollision } from './modulePipetteCollision'
import { thermocyclerPipetteCollision } from './thermocyclerPipetteCollision'
import { getLabwareSlot } from './getLabwareSlot'
import { movableTrashCommandsUtil } from './movableTrashCommandsUtil'

export {
commandCreatorsTimeline,
Expand All @@ -13,6 +14,7 @@ export {
modulePipetteCollision,
thermocyclerPipetteCollision,
getLabwareSlot,
movableTrashCommandsUtil,
}
export * from './commandCreatorArgsGetters'
export * from './heaterShakerCollision'
Expand Down
1 change: 1 addition & 0 deletions step-generation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"compilerOptions": {
"composite": true,
"noErrorTruncation": true,
"emitDeclarationOnly": false,
"rootDir": "src",
"outDir": "lib"
},
Expand Down
3 changes: 0 additions & 3 deletions tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
"skipLibCheck": true,
"moduleResolution": "node",
"types": ["vite/client", "vitest/globals", "@testing-library/jest-dom"],
"paths": {
"@opentrons/shared-data": ["./shared-data"]
}
}
}
Loading

0 comments on commit 4fd27fd

Please sign in to comment.