Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix & elide typescript errors; error fail CI build #162

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"./CHANGELOG.md"
],
"scripts": {
"build": "npm run build:clean && npm run generate && vite build",
"build": "npm run build:clean && npm run generate && npm run tsc && vite build",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This felt like the best place to insert the typecheck. Broken types won't break your local dev build while you're working but will break both CI and publish here. There's some room for efficiency to run tsc and vite in parallel here but didn't feel worth right now.

"build:clean": "rm -rf ./dist && mkdir ./dist",
"commitlint": "commitlint --edit",
"dev": "node ./build/prompt.js && npm run build && vite build --watch",
Expand Down
2 changes: 2 additions & 0 deletions src/components/Common/TaxInputs/TaxInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function SelectInput({ question, requirement, control }: EmpQ | CompR) {
<Select
control={control}
name={key as string}
// @ts-expect-error HACK value is insufficiently narrowed here
defaultSelectedKey={value}
label={label}
description={description}
Expand All @@ -60,6 +61,7 @@ export function TextInput({ question, requirement, control }: EmpQ | CompR) {
control={control}
name={key as string}
label={label}
// @ts-expect-error HACK value is insufficiently narrowed here
defaultValue={value}
description={description}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useTranslation } from 'react-i18next'

export function Head() {
// @ts-expect-error HACK missing translations
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serikjensen Do you know if we can use Employee.DocumentSigner here or do we need to develop two sets of i18n files?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea what happened here if it was a rename that didn't get updated, but for some reason it points to a file that doesn't exist. it should be

const { t } = useTranslation('Company.DocumentList')

I have a fix for it included in this PR #159 (comment)

i'm good with you just adding the comment here and then rebasing that signature form PR and fixing it there

const { t } = useTranslation('Company.DocumentSigner')

return <h2>{t('documentListTitle')}</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useDocumentList } from './DocumentList'
function List() {
const { companyForms, handleRequestFormToSign, documentListError, isSelfSignatory } =
useDocumentList()
// @ts-expect-error HACK missing translations
const { t } = useTranslation('Company.DocumentSigner')

const onRequestSign = (requestedForm: FormData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function isValidSignatoryTitle(
}

function ManageSignatories() {
// @ts-expect-error HACK missing translations
const { t } = useTranslation('Company.DocumentSigner')
const { isSelfSignatory, signatory, handleChangeSignatory } = useDocumentList()

Expand Down
4 changes: 3 additions & 1 deletion src/components/Employee/EmployeeList/EmployeeList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { handleGetCompanyEmployees } from '@/test/mocks/apis/employees'
import { HttpResponse } from 'msw'
import { mockResizeObserver } from 'jsdom-testing-mocks'

const resizeObserver = mockResizeObserver()
beforeEach(() => {
mockResizeObserver()
})

describe('EmployeeList', () => {
beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Employee/EmployeeList/EmployeeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function Root({ companyId, className, children }: EmployeeListProps) {
handleNew,
handleReview,
handleDelete,
// @ts-expect-error HACK fix employee typing inconsistency
employees,
currentPage,
totalPages,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Employee/EmployeeList/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const List = () => {
} = useEmployeeList()

const { t } = useTranslation('Employee.EmployeeList')
const [deleting, setDeleting] = useState<Set<string>>(new Set())
const [_, setDeleting] = useState<Set<string>>(new Set())
const { ...dataViewProps } = useDataView({
data: employees,
columns: [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Employee/Profile/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTranslation } from 'react-i18next'
import { ActionsLayout, Button, Flex } from '@/components/Common'
import { ActionsLayout, Button } from '@/components/Common'
import { useProfile } from '@/components/Employee/Profile/Profile'

export const Actions = () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Employee/Profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ const Root = ({ isAdmin = false, ...props }: ProfileProps) => {
const workAddressData = await mutateEmployeeWorkAddress({
work_address_uuid: mergedData.current.workAddress.uuid,
body: {
// @ts-expect-error HACK fix disagreement between args and API expectation
version: mergedData.current.workAddress.version,
location_uuid: work_address,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { transition, reduce, state } from 'robot3'
import { componentEvents } from '@/shared/constants'
import type { EmployeeSelfOnboardingContextInterface } from '@/components/Flow/EmployeeSelfOnboardingFlow'
import {
Profile,
Taxes,
Expand All @@ -9,6 +8,7 @@ import {
OnboardingSummary,
} from '@/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingComponents'
import { SDKI18next } from '@/contexts'
import { EmployeeSelfOnboardingContextInterface } from '@/components/Flow/EmployeeSelfOnboardingFlow/EmployeeSelfOnboardingFlow'

export const employeeSelfOnboardingMachine = {
index: state(
Expand Down
1 change: 1 addition & 0 deletions src/contexts/ThemeProvider/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
}, [partnerTheme, t])

return (
// @ts-expect-error HACK fix mismatch where containerRef allows null
<ThemeContext.Provider value={{ container: containerRef }}>
<section className="GSDK" data-testid="GSDK" ref={containerRef}>
{children}
Expand Down
1 change: 1 addition & 0 deletions src/test/mocks/apis/homeAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const getEmployeeHomeAddresses = http.get<
const createEmployeeHomeAddress = http.post<
PathParams<'post-v1-employees-employee_id-home_addresses'>,
RequestBodyParams<'post-v1-employees-employee_id-home_addresses'>,
// @ts-expect-error HACK re-check after Speakeasy implementation
ResponseType<'post-v1-employees-employee_id-home_addresses', 200>
>(`${API_BASE_URL}/v1/employees/:employee_id/home_addresses`, async ({ request }) => {
const requestBody = await request.json()
Expand Down
1 change: 1 addition & 0 deletions src/test/mocks/apis/typeHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { operations } from '@/types/schema'
// Type Helpers
export type PathParams<Operation extends keyof operations> =
operations[Operation]['parameters']['path']
// @ts-expect-error HACK revisit after Speakeasy implementation
export type RequestBodyParams<Operation extends keyof operations> = NonNullable<
operations[Operation]['requestBody']
>['content']['application/json']
Expand Down
1 change: 1 addition & 0 deletions src/test/mocks/fixtures/company_location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const COMPANY_LOCATION_FORM_PAYLOAD = {
city: 'Anytown',
state: 'ABC',
zip: '12345',
// @ts-expect-error HACK fix `country` typings
country: 'USA',
mailing_address: true,
filing_address: false,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"module": "ESNext",
"moduleDetection": "force",
"allowJs": true,
"noEmit": false,
"noEmit": true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually compile with tsc, just typecheck. vite runs our compilation step via esbuild, so we can save some time/duplication by just telling tsc not to emit files.

"jsx": "react-jsx",
"moduleResolution": "bundler",
"resolveJsonModule": true,
Expand Down