diff --git a/.yarnrc.yml b/.yarnrc.yml index e355d391d1c..8847b94fa47 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -30,18 +30,30 @@ npmPreapprovedPackages: - "@earendil-works/pi-ai@1.2.0" - "@earendil-works/pi-telemetry@1.2.0" -# Native tool input public declarations in the pinned local runtime patch. -# Patch manifest edits alone do not add dependencies during Yarn resolution. packageExtensions: + # Pass the checker's compiler through to Volar instead of resolving native TS7. + "@astrojs/language-server@2.16.13": + peerDependencies: + typescript: "^5.0.0 || ^6.0.0" + # Dependency analysis and its public types require the JavaScript compiler API. + "dependency-cruiser@18.0.0": + dependencies: + typescript: "6.0.3" + # Native tool input public declarations in the pinned local runtime patch. + # Patch manifest edits alone do not add dependencies during Yarn resolution. "@flue/runtime@2.3.0": dependencies: "@standard-schema/spec": "1.1.0" catalog: tsx: "4.20.6" - typescript: "6.0.3" + typescript: "7.0.2" "@typescript/typescript6": "6.0.2" vite: "8.3.4" vitest: "4.1.11" "@tsconfig/bases": "1.0.28" "@types/node": "22.18.13" + +catalogs: + typescript6: + typescript: "6.0.3" diff --git a/apps/brunch-agent/package.json b/apps/brunch-agent/package.json index 873150d6ba0..c0a7d4abc63 100644 --- a/apps/brunch-agent/package.json +++ b/apps/brunch-agent/package.json @@ -15,7 +15,7 @@ "dev": "vite dev", "fix:eslint": "oxlint --fix --type-aware --type-check --report-unused-disable-directives-severity=error .", "lint:eslint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error .", - "lint:tsc": "tsgo --noEmit", + "lint:tsc": "tsc --noEmit", "packet:run": "node --experimental-strip-types --disable-warning=ExperimentalWarning evals/petrinaut/run-packet-cli.ts", "persona": "node --experimental-strip-types evals/petrinaut/persona/launch.ts", "petrinaut:dev": "vite dev --config petrinaut-local.vite.config.ts", @@ -61,12 +61,12 @@ "@types/pg": "8.23.1", "@types/react": "19.2.14", "@types/react-dom": "19.2.3", - "@typescript/native-preview": "7.0.0-dev.20260511.1", "@valibot/to-json-schema": "1.7.1", "ai": "6.0.286", "dependency-cruiser": "18.0.0", "oxlint": "1.86.0", "oxlint-tsgolint": "7.0.2003", + "typescript": "catalog:", "vite": "catalog:", "vitest": "catalog:", "wait-on": "9.0.1" diff --git a/apps/hash-ai-worker-ts/scripts/flow-scenarios/run-flow-scenario.ts b/apps/hash-ai-worker-ts/scripts/flow-scenarios/run-flow-scenario.ts index 3da8ca5296e..b348ea3603f 100644 --- a/apps/hash-ai-worker-ts/scripts/flow-scenarios/run-flow-scenario.ts +++ b/apps/hash-ai-worker-ts/scripts/flow-scenarios/run-flow-scenario.ts @@ -318,17 +318,14 @@ const ensureFlowDefinitionEntity = async ({ const properties = mapFlowDefinitionToEntityProperties(flowDefinition); const existingEntity = await getFlowDefinitionEntityById({ - flowDefinitionEntityId: entityIdFromComponents( - userId as WebId, - flowDefinitionId, - ), + flowDefinitionEntityId: entityIdFromComponents(userId, flowDefinitionId), graphApiClient: graphApi, userAuthentication: authentication, }); if (!existingEntity) { await HashEntity.create(graphApi, authentication, { - webId: userId as WebId, + webId: userId, entityUuid: flowDefinitionId, entityTypeIds, properties, @@ -421,7 +418,7 @@ const seedEntities = async ({ for (const [index, { entityTypeId, properties }] of entities.entries()) { await HashEntity.create(graphApi, authentication, { - webId: userId as WebId, + webId: userId, entityTypeIds: [entityTypeId], properties: mergePropertyObjectAndMetadata(properties, undefined), provenance: { actorType: "user", origin: { type: "api" } }, @@ -646,7 +643,7 @@ const describeWorkflowError = (error: unknown) => { while (current?.cause) { activityType = current.activityType ?? activityType; - current = current.cause as typeof current; + current = current.cause; } return `${activityType ? `\`${activityType}\` failed: ` : ""}${current?.message ?? "unknown error"}`; @@ -909,15 +906,12 @@ const main = async () => { const workflowError = await workflowErrorWhenClosed; const flowRun = await getFlowRunFromTemporalWorkflowId({ - flowDefinitionEntityId: entityIdFromComponents( - userId as WebId, - flowDefinitionId, - ), - flowRunEntityId: entityIdFromComponents(userId as WebId, workflowId), + flowDefinitionEntityId: entityIdFromComponents(userId, flowDefinitionId), + flowRunEntityId: entityIdFromComponents(userId, workflowId), name: flowDefinition.name, temporalClient: client, temporalWorkflowId: workflowId, - webId: userId as WebId, + webId: userId, storageProvider: getStorageProvider(), }); diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/aggregate-action.test.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/aggregate-action.test.ts index dfcebe9bde9..a3a1b9ac712 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/aggregate-action.test.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/aggregate-action.test.ts @@ -172,7 +172,7 @@ describe("aggregateAction", () => { "00000000-0000-4000-8000-000000000001~00000000-0000-4000-8000-000000000011" as EntityId; vi.mocked(queryEntities).mockResolvedValueOnce({ entities: [], - } as unknown as QueryEntitiesResponse); + }); expect( await run({ kind: "EntityId", value: [entityId] }, scoreSum), diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/filter-list-action.test.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/filter-list-action.test.ts index 0ca8c5e196c..5bc77be30f5 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/filter-list-action.test.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/filter-list-action.test.ts @@ -141,7 +141,7 @@ describe("filterListAction", () => { recordId: { entityId }, entityTypeIds: [ index === 1 - ? ("https://example.com/types/entity-type/person/v/1" as VersionedUrl) + ? "https://example.com/types/entity-type/person/v/1" : companyType, ], }, @@ -203,6 +203,7 @@ describe("filterListAction", () => { const result = await run( { kind: "EntityId", + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- These malformed fixtures still need EntityId branding despite other Payload variants accepting strings. value: [validEntityId, "" as EntityId, "not-an-entity-id" as EntityId], }, isCompany, @@ -467,7 +468,7 @@ describe("filterListAction", () => { it("reports an entity the user can't read as not found", async () => { vi.mocked(queryEntities).mockResolvedValueOnce({ entities: [], - } as unknown as QueryEntitiesResponse); + }); expect( await run({ kind: "EntityId", value: [validEntityId] }, isCompany), diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/find-action.test.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/find-action.test.ts index 5064b662962..ea10a3de5ab 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/find-action.test.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/find-action.test.ts @@ -18,7 +18,6 @@ import type { VersionedUrl, } from "@blockprotocol/type-system"; import type { FileStorageProvider } from "@local/hash-backend-utils/file-storage"; -import type { QueryEntitiesResponse } from "@local/hash-graph-sdk/entity"; import type { FilterCondition } from "@local/hash-isomorphic-utils/flows/filter-condition"; import type { Payload, @@ -224,7 +223,7 @@ describe("findAction", () => { "00000000-0000-4000-8000-000000000001~00000000-0000-4000-8000-000000000011" as EntityId; vi.mocked(queryEntities).mockResolvedValueOnce({ entities: [], - } as unknown as QueryEntitiesResponse); + }); expect( await run( @@ -238,8 +237,7 @@ describe("findAction", () => { operator: "isOfType", value: { kind: "VersionedUrl", - value: - "https://example.com/types/entity-type/company/v/1" as VersionedUrl, + value: "https://example.com/types/entity-type/company/v/1", }, }, ], diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-chart-config-action.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-chart-config-action.ts index 3a581121ec1..98c36b5129b 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-chart-config-action.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-chart-config-action.ts @@ -94,10 +94,7 @@ const tools: LlmToolDefinition[] = [ * string rather than an object — parse it before schema validation. */ sanitizeInputBeforeValidation: (rawInput) => { - if ( - "config" in rawInput && - typeof (rawInput as { config: unknown }).config === "string" - ) { + if ("config" in rawInput && typeof rawInput.config === "string") { return { ...rawInput, config: JSON.parse( @@ -332,7 +329,7 @@ export const generateChartConfigAction: FlowActionActivity< Array.isArray(parsedChartData) && parsedChartData.length > 0 && parsedChartData[0] - ? Object.keys(parsedChartData[0] as object).join(", ") + ? Object.keys(parsedChartData[0]).join(", ") : "unknown" } diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-structural-query-action.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-structural-query-action.ts index 863edf4dccf..a3549a43539 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-structural-query-action.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/generate-structural-query-action.ts @@ -560,7 +560,7 @@ const tools: LlmToolDefinition[] = [ }, required: ["filter"], additionalProperties: false, - $defs: filterSchemaDefinitions as Record, + $defs: filterSchemaDefinitions, }, }, { @@ -598,7 +598,7 @@ const tools: LlmToolDefinition[] = [ }, required: ["filter", "explanation", "suggestedChartTypes"], additionalProperties: false, - $defs: filterSchemaDefinitions as Record, + $defs: filterSchemaDefinitions, }, }, ]; diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/order-by-action.test.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/order-by-action.test.ts index 03c21be0a9b..54cf324bbc8 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/order-by-action.test.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/order-by-action.test.ts @@ -146,7 +146,7 @@ describe("orderByAction", () => { "00000000-0000-4000-8000-000000000001~00000000-0000-4000-8000-000000000011" as EntityId; vi.mocked(queryEntities).mockResolvedValueOnce({ entities: [], - } as unknown as QueryEntitiesResponse); + }); expect(await run({ kind: "EntityId", value: [entityId] }, byScore)).toEqual( { diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/write-google-sheet-action/convert-subgraph-to-sheet-requests.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/write-google-sheet-action/convert-subgraph-to-sheet-requests.ts index 2645510d12c..d5af548fe51 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/write-google-sheet-action/convert-subgraph-to-sheet-requests.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/write-google-sheet-action/convert-subgraph-to-sheet-requests.ts @@ -106,7 +106,7 @@ const createColumnsForEntity = ( for (const { schema } of entityTypeAndParents) { for (const baseUrl of typedKeys(schema.properties)) { - properties.add(baseUrl as BaseUrl); + properties.add(baseUrl); } for (const linkTypeId of typedKeys(schema.links ?? {})) { links.add(linkTypeId); diff --git a/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/get-openai-reponse.ts b/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/get-openai-reponse.ts index 0ed07a37879..45641613bb1 100644 --- a/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/get-openai-reponse.ts +++ b/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/get-openai-reponse.ts @@ -55,7 +55,7 @@ const mapLlmToolDefinitionToOpenAiToolDefinition = ( */ strict: false, name: tool.name, - parameters: tool.inputSchema as OpenAI.FunctionParameters, + parameters: tool.inputSchema, description: tool.description, }, }); diff --git a/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/llm-message.ts b/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/llm-message.ts index 4e6cc31722b..949d88dd7b6 100644 --- a/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/llm-message.ts +++ b/apps/hash-ai-worker-ts/src/activities/shared/get-llm-response/llm-message.ts @@ -395,7 +395,7 @@ export const mapOpenAiMessagesToLlmMessages = (params: { { role: "user", content: [toolResultContent], - } as LlmUserMessage, + }, ]; } diff --git a/apps/hash-ai-worker-ts/src/shared/testing-utilities/mock-get-flow-context.ts b/apps/hash-ai-worker-ts/src/shared/testing-utilities/mock-get-flow-context.ts index e34b38abb68..913a845221c 100644 --- a/apps/hash-ai-worker-ts/src/shared/testing-utilities/mock-get-flow-context.ts +++ b/apps/hash-ai-worker-ts/src/shared/testing-utilities/mock-get-flow-context.ts @@ -137,7 +137,7 @@ vi.mock("@local/hash-backend-utils/temporal", async (importOriginal) => { }, }, flowDefinitionEntityId: entityIdFromComponents( - aliceUserAccountId as WebId, + aliceUserAccountId, generateUuid() as EntityUuid, ), flowInputs: {}, diff --git a/apps/hash-api/src/analysis/analyses/dashboards.test.ts b/apps/hash-api/src/analysis/analyses/dashboards.test.ts index 8dc5c6ed49a..3ce4f88280c 100644 --- a/apps/hash-api/src/analysis/analyses/dashboards.test.ts +++ b/apps/hash-api/src/analysis/analyses/dashboards.test.ts @@ -9,7 +9,6 @@ import { import type { ActorEntityUuid, MachineId, - RoleName, WebId, } from "@blockprotocol/type-system"; import type { FileStorageProvider } from "@local/hash-backend-utils/file-storage"; @@ -177,7 +176,7 @@ describe("dashboardItemData analysis", () => { registerAnalyses(dashboardAnalyses); mockedGetRole.mockReset(); - mockedGetRole.mockResolvedValue("member" as RoleName); + mockedGetRole.mockResolvedValue("member"); mockedGetWebMachineId.mockReset(); mockedGetWebMachineId.mockResolvedValue(WEB_MACHINE_ID); @@ -209,7 +208,7 @@ describe("dashboardItemData analysis", () => { it("errors when the item does not exist in the web", async () => { mockedQueryEntities.mockResolvedValue({ entities: [], - } as unknown as Awaited>); + }); const result = await resolve({ itemUuid: ITEM_UUID }); expect(result.status).toBe("error"); diff --git a/apps/hash-api/src/analysis/setup-analysis-handler/resolve-analysis.test.ts b/apps/hash-api/src/analysis/setup-analysis-handler/resolve-analysis.test.ts index f8c4c59f101..f1c07a7ea83 100644 --- a/apps/hash-api/src/analysis/setup-analysis-handler/resolve-analysis.test.ts +++ b/apps/hash-api/src/analysis/setup-analysis-handler/resolve-analysis.test.ts @@ -1,10 +1,6 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; -import type { - ActorEntityUuid, - RoleName, - WebId, -} from "@blockprotocol/type-system"; +import type { ActorEntityUuid, WebId } from "@blockprotocol/type-system"; import type { FileStorageProvider } from "@local/hash-backend-utils/file-storage"; import type Keyv from "keyv"; @@ -89,7 +85,7 @@ describe("resolveInvocation (supply-chain analyses)", () => { clearAnalysisRegistry(); registerAnalyses(supplyChainAnalyses); mockedGetRole.mockReset(); - mockedGetRole.mockResolvedValue("member" as RoleName); + mockedGetRole.mockResolvedValue("member"); }); it("resolves productGraph to a presigned graph artifact", async () => { @@ -387,7 +383,7 @@ describe("resolveInvocation (supply-chain analyses)", () => { getObjectLastModified: async () => { throw new Error("Storage unavailable"); }, - } as unknown as FileStorageProvider, + }, cache, }); diff --git a/apps/hash-api/src/auth/kratos-endpoint-allowlist.test.ts b/apps/hash-api/src/auth/kratos-endpoint-allowlist.test.ts index ba34158d150..a0d4f91ccff 100644 --- a/apps/hash-api/src/auth/kratos-endpoint-allowlist.test.ts +++ b/apps/hash-api/src/auth/kratos-endpoint-allowlist.test.ts @@ -14,7 +14,7 @@ import { } from "./kratos-endpoint-allowlist"; import type { Logger } from "@local/hash-backend-utils/logger"; -import type { NextFunction, Request, RequestHandler, Response } from "express"; +import type { Request, Response } from "express"; import type { AddressInfo } from "node:net"; vi.mock("@sentry/node", () => ({ captureMessage: vi.fn() })); @@ -325,7 +325,7 @@ describe("guardKratosProxy", () => { const guarded = guardKratosProxy({ logger: { error } as unknown as Logger, - proxy: proxy as unknown as RequestHandler, + proxy, }); const call = ( @@ -341,7 +341,7 @@ describe("guardKratosProxy", () => { ip, } as unknown as Request, { sendStatus } as unknown as Response, - next as unknown as NextFunction, + next, ); }; diff --git a/apps/hash-api/src/graph/knowledge/primitive/entity/before-update-entity-hooks/user-before-update-entity-hook-callback.ts b/apps/hash-api/src/graph/knowledge/primitive/entity/before-update-entity-hooks/user-before-update-entity-hook-callback.ts index 4a0df76019c..12592e6915d 100644 --- a/apps/hash-api/src/graph/knowledge/primitive/entity/before-update-entity-hooks/user-before-update-entity-hook-callback.ts +++ b/apps/hash-api/src/graph/knowledge/primitive/entity/before-update-entity-hooks/user-before-update-entity-hook-callback.ts @@ -33,11 +33,7 @@ import { import type { ImpureGraphContext } from "../../../../context-types"; import type { BeforeUpdateEntityHookCallback } from "../update-entity-hooks"; -import type { - ActorEntityUuid, - BaseUrl, - WebId, -} from "@blockprotocol/type-system"; +import type { ActorEntityUuid, BaseUrl } from "@blockprotocol/type-system"; import type { UserProperties } from "@local/hash-isomorphic-utils/system-types/user"; /** @@ -255,7 +251,7 @@ export const userBeforeEntityUpdateHookCallback: BeforeUpdateEntityHookCallback await updateWebShortname( context.graphApi, { actorId: systemAccountId }, - { webId: user.accountId as WebId, shortname: updatedShortname }, + { webId: user.accountId, shortname: updatedShortname }, ); } }; diff --git a/apps/hash-api/src/graph/knowledge/system-types/comment.ts b/apps/hash-api/src/graph/knowledge/system-types/comment.ts index c1cfcc97464..52c2a4eb94a 100644 --- a/apps/hash-api/src/graph/knowledge/system-types/comment.ts +++ b/apps/hash-api/src/graph/knowledge/system-types/comment.ts @@ -453,7 +453,7 @@ export const getCommentAncestorBlock: ImpureGraphFunction< ) ) { // @todo - make sure the entity is really a block - return getBlockFromEntity({ entity: parentEntity as Block["entity"] }); + return getBlockFromEntity({ entity: parentEntity }); } else { return getCommentAncestorBlock(context, authentication, { commentEntityId: parentEntity.metadata.recordId.entityId, diff --git a/apps/hash-api/src/graph/knowledge/system-types/user-secret.ts b/apps/hash-api/src/graph/knowledge/system-types/user-secret.ts index 2b8928b9b3e..19aee5d9201 100644 --- a/apps/hash-api/src/graph/knowledge/system-types/user-secret.ts +++ b/apps/hash-api/src/graph/knowledge/system-types/user-secret.ts @@ -15,7 +15,6 @@ import type { MachineId, ProvidedEntityEditionProvenance, UserId, - WebId, } from "@blockprotocol/type-system"; import type { UserSecretService, @@ -165,7 +164,7 @@ export const createUserSecret = async < authentication, { entityTypeIds: [systemEntityTypes.userSecret.entityTypeId], - webId: userAccountId as WebId, + webId: userAccountId, entityUuid: userSecretEntityUuid, properties: secretMetadata, policies: [ @@ -188,7 +187,7 @@ export const createUserSecret = async < { graphApi, provenance }, authentication, { - webId: userAccountId as WebId, + webId: userAccountId, entityUuid: usesUserSecretEntityUuid, properties: { value: {} }, linkData: { diff --git a/apps/hash-api/src/graphql/resolvers/knowledge/user/submit-early-access-form.ts b/apps/hash-api/src/graphql/resolvers/knowledge/user/submit-early-access-form.ts index 872bf36c243..cfcd6ab6091 100644 --- a/apps/hash-api/src/graphql/resolvers/knowledge/user/submit-early-access-form.ts +++ b/apps/hash-api/src/graphql/resolvers/knowledge/user/submit-early-access-form.ts @@ -10,7 +10,6 @@ import type { ResolverFn, } from "../../../api-types.gen"; import type { LoggedInGraphQLContext } from "../../../context"; -import type { WebId } from "@blockprotocol/type-system"; import type { ProspectiveUser } from "@local/hash-isomorphic-utils/system-types/prospectiveuser"; export const submitEarlyAccessFormResolver: ResolverFn< @@ -31,7 +30,7 @@ export const submitEarlyAccessFormResolver: ResolverFn< /** The user does not yet have permissions to create entities, so we do it with the HASH system account instead */ authentication, { - webId: user.accountId as WebId, + webId: user.accountId, entityTypeIds: [systemEntityTypes.prospectiveUser.entityTypeId], properties: { value: { diff --git a/apps/hash-api/src/graphql/resolvers/ontology/entity-type.ts b/apps/hash-api/src/graphql/resolvers/ontology/entity-type.ts index aa7e7794241..33f0d259302 100644 --- a/apps/hash-api/src/graphql/resolvers/ontology/entity-type.ts +++ b/apps/hash-api/src/graphql/resolvers/ontology/entity-type.ts @@ -36,7 +36,6 @@ import type { GraphQLContext, LoggedInGraphQLContext } from "../../context"; import type { EntityTypeWithMetadata, OntologyTemporalMetadata, - WebId, } from "@blockprotocol/type-system"; import type { UserPermissionsOnEntityType } from "@local/hash-graph-sdk/authorization"; import type { @@ -58,7 +57,7 @@ export const createEntityTypeResolver: ResolverFn< const { webId, entityType } = params; const createdEntityType = await createEntityType(context, authentication, { - webId: webId ?? (user.accountId as WebId), + webId: webId ?? user.accountId, schema: entityType, }); diff --git a/apps/hash-api/src/graphql/resolvers/ontology/property-type.ts b/apps/hash-api/src/graphql/resolvers/ontology/property-type.ts index 0f52e150014..fb30bb15456 100644 --- a/apps/hash-api/src/graphql/resolvers/ontology/property-type.ts +++ b/apps/hash-api/src/graphql/resolvers/ontology/property-type.ts @@ -27,7 +27,6 @@ import type { GraphQLContext, LoggedInGraphQLContext } from "../../context"; import type { OntologyTemporalMetadata, PropertyTypeWithMetadata, - WebId, } from "@blockprotocol/type-system"; export const createPropertyTypeResolver: ResolverFn< @@ -46,7 +45,7 @@ export const createPropertyTypeResolver: ResolverFn< context, authentication, { - webId: (webId ?? user.accountId) as WebId, + webId: webId ?? user.accountId, schema: propertyType, }, ); diff --git a/apps/hash-api/src/integrations/google/oauth-callback.ts b/apps/hash-api/src/integrations/google/oauth-callback.ts index 9310243169d..298e5d9e3b5 100644 --- a/apps/hash-api/src/integrations/google/oauth-callback.ts +++ b/apps/hash-api/src/integrations/google/oauth-callback.ts @@ -12,7 +12,6 @@ import { createEntity } from "../../graph/knowledge/primitive/entity"; import { createUserSecret } from "../../graph/knowledge/system-types/user-secret"; import { enabledIntegrations } from "../enabled-integrations"; -import type { WebId } from "@blockprotocol/type-system"; import type { GoogleOAuth2CallbackRequest, GoogleOAuth2CallbackResponse, @@ -125,7 +124,7 @@ export const googleOAuthCallback: RequestHandler< newGoogleAccountEntity = await createEntity(req.context, authentication, { entityTypeIds: [googleEntityTypes.account.entityTypeId], - webId: req.user.accountId as WebId, + webId: req.user.accountId, properties: googleAccountProperties, }); } diff --git a/apps/hash-api/src/integrations/linear/oauth.ts b/apps/hash-api/src/integrations/linear/oauth.ts index 084fbe86f57..74fecc17aab 100644 --- a/apps/hash-api/src/integrations/linear/oauth.ts +++ b/apps/hash-api/src/integrations/linear/oauth.ts @@ -25,7 +25,6 @@ import type { EntityId, EntityUuid, UserId, - WebId, } from "@blockprotocol/type-system"; import type { LinearIntegrationPropertiesWithMetadata } from "@local/hash-isomorphic-utils/system-types/linearintegration"; import type { RequestHandler } from "express"; @@ -246,7 +245,7 @@ export const oAuthLinearCallback: RequestHandler< authentication, { entityTypeIds: [systemEntityTypes.linearIntegration.entityTypeId], - webId: userAccountId as WebId, + webId: userAccountId, entityUuid, properties: linearIntegrationProperties, }, diff --git a/apps/hash-frontend/eslint.config.js b/apps/hash-frontend/eslint.config.js index 90422942cd5..7e3b5ed6d46 100644 --- a/apps/hash-frontend/eslint.config.js +++ b/apps/hash-frontend/eslint.config.js @@ -1,10 +1,9 @@ -import reactX from "eslint-plugin-react-x"; - import { defineConfig, createBase, disableRules, } from "@local/eslint/deprecated"; +import { reactX } from "@local/eslint/plugins"; export default [ ...createBase(import.meta.dirname), diff --git a/apps/hash-frontend/package.json b/apps/hash-frontend/package.json index c9ed27c90ff..74ddddda7aa 100644 --- a/apps/hash-frontend/package.json +++ b/apps/hash-frontend/package.json @@ -188,7 +188,6 @@ "@types/url-regex-safe": "1.0.2", "@welldone-software/why-did-you-render": "10.0.1", "eslint": "9.39.4", - "eslint-plugin-react-x": "1.17.2", "graphology-types": "0.24.8", "jsdom": "24.1.3", "rimraf": "6.1.3", @@ -196,6 +195,6 @@ "typescript": "catalog:", "vitest": "catalog:", "wait-on": "9.0.1", - "webpack": "5.104.1" + "webpack": "5.107.2" } } diff --git a/apps/hash-frontend/src/blocks/use-fetch-block-subgraph.ts b/apps/hash-frontend/src/blocks/use-fetch-block-subgraph.ts index c8df6f7ef41..a4a32e697f3 100644 --- a/apps/hash-frontend/src/blocks/use-fetch-block-subgraph.ts +++ b/apps/hash-frontend/src/blocks/use-fetch-block-subgraph.ts @@ -17,14 +17,8 @@ import type { QueryEntitySubgraphQueryVariables, SubgraphAndPermissions as SubgraphAndPermissionsGQL, } from "../graphql/api-types.gen"; +import type { EntityRootType, Subgraph } from "@blockprotocol/graph"; import type { - EntityRootType, - KnowledgeGraphVertices, - Subgraph, -} from "@blockprotocol/graph"; -import type { - ActorEntityUuid, - EntityEditionId, EntityId, PropertyObject, VersionedUrl, @@ -65,8 +59,8 @@ export const useFetchBlockSubgraph = (): (( const placeholderEntity = new HashEntity({ metadata: { recordId: { - entityId: "placeholder-account~entity-id-not-set" as EntityId, - editionId: now as string as EntityEditionId, + entityId: "placeholder-account~entity-id-not-set", + editionId: now, }, entityTypeIds: blockEntityTypeIds, temporalVersioning: { @@ -92,13 +86,13 @@ export const useFetchBlockSubgraph = (): (( archived: false, provenance: { edition: { - createdById: "placeholder-account" as ActorEntityUuid, + createdById: "placeholder-account", actorType: "user", origin: { type: "web-app", }, }, - createdById: "placeholder-account" as ActorEntityUuid, + createdById: "placeholder-account", createdAtTransactionTime: now, createdAtDecisionTime: now, }, @@ -140,7 +134,7 @@ export const useFetchBlockSubgraph = (): (( inner: placeholderEntity, }, }, - } as KnowledgeGraphVertices, + }, temporalAxes: { initial: subgraphTemporalAxes, resolved: subgraphTemporalAxes, diff --git a/apps/hash-frontend/src/components/block-loader/block-loader.tsx b/apps/hash-frontend/src/components/block-loader/block-loader.tsx index 9a2c538ff70..148c848f675 100644 --- a/apps/hash-frontend/src/components/block-loader/block-loader.tsx +++ b/apps/hash-frontend/src/components/block-loader/block-loader.tsx @@ -33,7 +33,6 @@ import { RemoteBlock } from "../remote-block/remote-block"; import { fetchEmbedCode } from "./fetch-embed-code"; import type { - ArchiveEntityMessageCallback, CreateEntityMessageCallback, UpdateEntityMessageCallback, UploadFileRequestCallback, @@ -452,9 +451,7 @@ export const BlockLoader: FunctionComponent = ({ deleteEntity: async ( ...args: Parameters ) => { - const res = await deleteEntity( - args[0] as Parameters[0], - ); + const res = await deleteEntity(args[0]); await refetchSubgraph(); diff --git a/apps/hash-frontend/src/components/sandbox/framed-block/framed-block.tsx b/apps/hash-frontend/src/components/sandbox/framed-block/framed-block.tsx index e7bfb851d83..b29e488871b 100644 --- a/apps/hash-frontend/src/components/sandbox/framed-block/framed-block.tsx +++ b/apps/hash-frontend/src/components/sandbox/framed-block/framed-block.tsx @@ -29,10 +29,7 @@ export const FramedBlock: FunctionComponent = () => { const _beforeCapture = useCallback( (scope: Sentry.Scope) => { - scope.setTag( - "block", - blockProperties?.metadata.recordId.entityId as string, - ); + scope.setTag("block", blockProperties?.metadata.recordId.entityId); }, [blockProperties], ); diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/edge-document.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/edge-document.ts index af12347c844..62d2f422873 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/edge-document.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/edge-document.ts @@ -59,7 +59,7 @@ interface Head { } /** Reads the fields needed to interpret edge columns and the trailer. */ -const readHead = Result.fn(function* readHead( +const readHead = Result.fn(function* readEdgeHead( access: CborDecoder.CborMapAccess, ): Result.gen.Return { const partial: Partial> = {}; @@ -303,7 +303,7 @@ export interface DecodeOptions { } /** Assembles the envelope's edge columns with their decoded metadata. */ -const decodeDocument = Result.fn(function* decodeDocument< +const decodeDocument = Result.fn(function* decodeEdgeDocument< T extends ArrayBufferLike, >( decoder: Decoder.Decoder, diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.test.ts index 4b03b905be4..35f564688b5 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.test.ts @@ -123,10 +123,10 @@ describe("Envelope.decode success", () => { expect(positions.bytes?.[0]).toBe(0xfe); }); - it.each([ - { kind: "tile" as SaltileKind, magic: "SALTILET", minimum: 5 }, - { kind: "edges" as SaltileKind, magic: "SALTILEE", minimum: 4 }, - { kind: "locate" as SaltileKind, magic: "SALTILEL", minimum: 7 }, + it.each<{ readonly kind: SaltileKind; magic: string; minimum: number }>([ + { kind: "tile", magic: "SALTILET", minimum: 5 }, + { kind: "edges", magic: "SALTILEE", minimum: 4 }, + { kind: "locate", magic: "SALTILEL", minimum: 7 }, ])("decodes_$kind_at_minimum", ({ kind, magic, minimum }) => { const payloads: (number[] | null)[] = [ [0xa0], diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.ts index 1337aa0ed91..06a042695ad 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/envelope.ts @@ -115,7 +115,7 @@ export type DecodedEnvelope = readonly [ ]; /** Reads the common framing without interpreting individual payload contents. */ -const readEnvelope = Result.fn(function* readEnvelope< +const readEnvelope = Result.fn(function* readEnvelopeFields< T extends ArrayBufferLike, >( decoder: Decoder.Decoder, diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/iterable.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/iterable.test.ts index 37400250f97..c9304befffd 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/iterable.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/iterable.test.ts @@ -216,7 +216,7 @@ describe("Iterable", () => { }); it("zip_lazy", () => { - const first = vi.fn(function* first() { + const first = vi.fn(function* readFirst() { yield 1; yield 2; }); diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document.ts index 9527f398295..1e35251a2f8 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document.ts @@ -51,7 +51,7 @@ const checkCount = (field: string, expected: bigint) => ), ); -const decodeDocument = Result.fn(function* decodeDocument< +const decodeDocument = Result.fn(function* decodeLocateDocument< T extends ArrayBufferLike, >( decoder: Decoder.Decoder, diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document/head.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document/head.ts index 36c6178d4b3..5836796735f 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document/head.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/locate-document/head.ts @@ -53,7 +53,7 @@ const cellVisitor: CborDecoder.CborVisitor< }), }; -const readHead = Result.fn(function* readHead( +const readHead = Result.fn(function* readLocateHead( access: CborDecoder.CborMapAccess, ): Result.gen.Return< Head, diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/option.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/option.test.ts index 05cc0eec22c..bfae9b885a6 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/option.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/option.test.ts @@ -64,9 +64,7 @@ describe("Option", () => { expectTypeOf(Option.filter(isString)(option)).toEqualTypeOf< Option.Option >(); - expect(Option.filter(Option.some(1 as string | number), isString)).toEqual( - Option.none(), - ); + expect(Option.filter(Option.some(1), isString)).toEqual(Option.none()); }); it("lift_predicate_call_forms", () => { diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/result.composition.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/result.composition.test.ts index 4f49bf2902e..9a0994edf0f 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/result.composition.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/result.composition.test.ts @@ -129,7 +129,7 @@ describe("Result.All", () => { describe("Result.fn", () => { it("fresh_invocations", () => { const seen: number[] = []; - const increment = Result.fn(function* increment(value: number) { + const increment = Result.fn(function* incrementValue(value: number) { seen.push(value); return (yield* Result.ok(value)) + 1; }); @@ -140,7 +140,7 @@ describe("Result.fn", () => { }); it("generic_arguments", () => { - const identity = Result.fn(function* identity(value: T) { + const identity = Result.fn(function* yieldValue(value: T) { return yield* Result.ok(value); }); expectTypeOf(identity("text")).toEqualTypeOf>(); @@ -150,7 +150,7 @@ describe("Result.fn", () => { it("failed_step", () => { let continued = false; - const fail = Result.fn(function* fail() { + const fail = Result.fn(function* yieldFailure() { yield* Result.err("failed"); continued = true; return 1; diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document.ts index 1b55e54dbcf..999179340a8 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document.ts @@ -128,7 +128,7 @@ export interface DecodeOptions extends Head.Context { readonly detail: Detail.Detail; } -const decodeDocument = Result.fn(function* decodeDocument< +const decodeDocument = Result.fn(function* decodeTileDocument< T extends ArrayBufferLike, >( decoder: Decoder.Decoder, diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/head.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/head.ts index d8bc7859529..562d541e548 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/head.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/head.ts @@ -152,7 +152,7 @@ const boundsVisitor: CborDecoder.CborVisitor< }), }; -const readGlobal = Result.fn(function* readGlobal( +const readGlobal = Result.fn(function* readGlobalFields( access: CborDecoder.CborMapAccess, ): Result.gen.Return { const partial: Partial> = { bounds: null }; @@ -205,7 +205,7 @@ const globalVisitor: CborDecoder.CborVisitor< visitMap: readGlobal, }; -const readHead = Result.fn(function* readHead( +const readHead = Result.fn(function* readTileHead( access: CborDecoder.CborMapAccess, ): Result.gen.Return { const partial: Partial> = { global: null }; @@ -364,7 +364,7 @@ const checkGlobal = ( }; /** Reads metadata and validates the row partition and camera-framing metadata. */ -export const decode = Result.fn(function* decode( +export const decode = Result.fn(function* decodeTileHead( bytes: Uint8Array, ): Result.gen.Return { const head = yield* decodeHead(bytes); diff --git a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/trailer.ts b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/trailer.ts index 2c412bbc2aa..3ad3919e174 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/trailer.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/atlas-decode/tile-document/trailer.ts @@ -13,7 +13,7 @@ export interface TileDocumentTrailer { readonly icons: readonly (string | null)[]; } -const readTrailer = Result.fn(function* readTrailer( +const readTrailer = Result.fn(function* readTrailerFields( access: CborDecoder.CborMapAccess, delivered: Num.u64, ): Result.gen.Return { diff --git a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-edges-for-tiles.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-edges-for-tiles.test.ts index f21ff86bc0f..6b4dc181758 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-edges-for-tiles.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-edges-for-tiles.test.ts @@ -155,7 +155,7 @@ interface Captured { /** Stubs global fetch with canned routes, recording each path and JSON body. */ const stubTransport = (routes: Record Response>): Captured[] => { const captured: Captured[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { const path = new URL(url, BASE).pathname; captured.push({ path, @@ -166,7 +166,7 @@ const stubTransport = (routes: Record Response>): Captured[] => { }); const route = routes[path]; return Promise.resolve(route === undefined ? notFound() : route()); - }) as typeof fetch); + }); return captured; }; diff --git a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-locate.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-locate.test.ts index f02c7175214..c2633981645 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-locate.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-locate.test.ts @@ -32,8 +32,8 @@ import type { VersionedUrl } from "@blockprotocol/type-system"; const BASE = "http://api.test/atlas"; const COLORED_TYPES: readonly VersionedUrl[] = [ - "https://t.test/person/v/3" as VersionedUrl, - "https://t.test/authored/v/1" as VersionedUrl, + "https://t.test/person/v/3", + "https://t.test/authored/v/1", ]; const genHex = (byte: number): string => @@ -132,7 +132,7 @@ const stubAuthorityTransport = ( >, ): RecordedRequest[] => { const seen: RecordedRequest[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { const request: RecordedRequest = { path: new URL(url, BASE).pathname, authority: new Headers(init?.headers).get(ATLAS_AUTHORITY_HEADER), @@ -144,7 +144,7 @@ const stubAuthorityTransport = ( seen.push(request); const route = routes[request.path]; return Promise.resolve(route === undefined ? notFound() : route(request)); - }) as typeof fetch); + }); return seen; }; diff --git a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-tile.test.ts b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-tile.test.ts index 51c0463b2e7..c3cf9f0712c 100644 --- a/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-tile.test.ts +++ b/apps/hash-frontend/src/components/tiled-network-graph/tiling/fetch-tile.test.ts @@ -402,12 +402,12 @@ const unauthorized = (): Response => /** Stubs the global fetch with canned routes and records every path hit. */ const stubTransport = (routes: Record Response>): string[] => { const paths: string[] = []; - vi.stubGlobal("fetch", ((url: string) => { + vi.stubGlobal("fetch", (url: string) => { const path = new URL(url, BASE).pathname; paths.push(path); const route = routes[path]; return Promise.resolve(route === undefined ? notFound() : route()); - }) as typeof fetch); + }); return paths; }; @@ -698,7 +698,7 @@ describe("fetchTile", () => { it("requests the detail trailer and attaches per-point labels", async () => { const generation = genHex(0x66); const bodies: (string | undefined)[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { const path = new URL(url, BASE).pathname; if (path.includes("/atlas/tile/")) { bodies.push(typeof init?.body === "string" ? init.body : undefined); @@ -711,7 +711,7 @@ describe("fetchTile", () => { return Promise.resolve(manifest(generation)); } return Promise.resolve(notFound()); - }) as typeof fetch); + }); const { nodes } = await fetchTile(u64(3), u64(13), { baseUrl: BASE, @@ -732,7 +732,7 @@ describe("fetchTile", () => { it("sends coloredTypeIds and decodes the per-point type mask", async () => { const generation = genHex(0x77); const bodies: (string | undefined)[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { const path = new URL(url, BASE).pathname; if (path.includes("/atlas/tile/")) { bodies.push(typeof init?.body === "string" ? init.body : undefined); @@ -745,7 +745,7 @@ describe("fetchTile", () => { return Promise.resolve(manifest(generation)); } return Promise.resolve(notFound()); - }) as typeof fetch); + }); const { nodes } = await fetchTile(u64(3), u64(13), { baseUrl: BASE, @@ -825,11 +825,11 @@ describe("the atlas base", () => { saltile(tileBytes(0x99, 3, 5, 1)), }; const credentials: (RequestCredentials | undefined)[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { credentials.push(init?.credentials); const route = routes[new URL(url, BASE).pathname]; return Promise.resolve(route === undefined ? notFound() : route()); - }) as typeof fetch); + }); await fetchTile(u64(3), u64(13), { baseUrl: BASE }); @@ -971,7 +971,7 @@ const stubAuthorityTransport = ( >, ): RecordedRequest[] => { const seen: RecordedRequest[] = []; - vi.stubGlobal("fetch", ((url: string, init?: RequestInit) => { + vi.stubGlobal("fetch", (url: string, init?: RequestInit) => { const request: RecordedRequest = { path: new URL(url, BASE).pathname, method: init?.method ?? "GET", @@ -982,7 +982,7 @@ const stubAuthorityTransport = ( seen.push(request); const route = routes[request.path]; return Promise.resolve(route === undefined ? notFound() : route(request)); - }) as typeof fetch); + }); return seen; }; diff --git a/apps/hash-frontend/src/lib/user-and-org.ts b/apps/hash-frontend/src/lib/user-and-org.ts index 7107fac6380..4d8e5eed894 100644 --- a/apps/hash-frontend/src/lib/user-and-org.ts +++ b/apps/hash-frontend/src/lib/user-and-org.ts @@ -223,7 +223,7 @@ export const constructOrg = (params: { ) { hasBio = { linkEntity: linkEntityRevision, - profileBioEntity: rightEntityRevision as HashEntity, + profileBioEntity: rightEntityRevision, }; continue; } diff --git a/apps/hash-frontend/src/pages/@/[shortname].page/edit-pinned-entity-types-modal.tsx b/apps/hash-frontend/src/pages/@/[shortname].page/edit-pinned-entity-types-modal.tsx index 62d61bfd9fe..9397a4db4c1 100644 --- a/apps/hash-frontend/src/pages/@/[shortname].page/edit-pinned-entity-types-modal.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname].page/edit-pinned-entity-types-modal.tsx @@ -35,7 +35,7 @@ import type { UpdateEntityMutationVariables, } from "../../../graphql/api-types.gen"; import type { Org, User } from "../../../lib/user-and-org"; -import type { EntityTypeWithMetadata, WebId } from "@blockprotocol/type-system"; +import type { EntityTypeWithMetadata } from "@blockprotocol/type-system"; import type { ModalProps } from "@mui/material"; import type { FunctionComponent, ReactElement } from "react"; import type { @@ -102,7 +102,7 @@ export const EditPinnedEntityTypesModal: FunctionComponent< >(updateEntityMutation, { errorPolicy: "all" }); const { createEntityType } = useBlockProtocolCreateEntityType( - authenticatedUser.accountId as WebId, + authenticatedUser.accountId, ); const { control, reset, handleSubmit, formState } = diff --git a/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-form.tsx b/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-form.tsx index 90567b7afcf..bbda178f020 100644 --- a/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-form.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-form.tsx @@ -28,7 +28,6 @@ import type { User, UserServiceAccount, } from "../../../../lib/user-and-org"; -import type { WebId } from "@blockprotocol/type-system"; import type { HashEntity, HashLinkEntity } from "@local/hash-graph-sdk/entity"; import type { ProfileURLPropertyValueWithMetadata } from "@local/hash-isomorphic-utils/system-types/shared"; import type { FunctionComponent } from "react"; @@ -57,9 +56,7 @@ export const UserProfileInfoForm: FunctionComponent<{ const [updateUser] = useUpdateAuthenticatedUser(); const { archiveEntity } = useBlockProtocolArchiveEntity(); - const { createEntity } = useBlockProtocolCreateEntity( - userProfile.accountId as WebId, - ); + const { createEntity } = useBlockProtocolCreateEntity(userProfile.accountId); const [updateEntity] = useMutation< UpdateEntityMutation, diff --git a/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-modal-header.tsx b/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-modal-header.tsx index 46c1d6118ee..3f06971ffea 100644 --- a/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-modal-header.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname].page/edit-user-profile-info-modal/user-profile-info-modal-header.tsx @@ -15,7 +15,6 @@ import { useUpdateProfileAvatar } from "../../[shortname]/shared/use-update-prof import { leftColumnWidth } from "../util"; import type { User } from "../../../../lib/user-and-org"; -import type { WebId } from "@blockprotocol/type-system"; import type { ChangeEventHandler, FunctionComponent } from "react"; // const AvatarButton = styled((props: ButtonProps) => ( @@ -137,7 +136,7 @@ export const UserProfileInfoModalHeader: FunctionComponent<{ // setNewCoverImageUploading(true); await uploadFile({ - webId: userProfile.accountId as WebId, + webId: userProfile.accountId, makePublic: true, fileData: { description: `The cover image for the ${userProfile.displayName} user in HASH`, diff --git a/apps/hash-frontend/src/pages/@/[shortname].page/pinned-entity-type-tab-contents.tsx b/apps/hash-frontend/src/pages/@/[shortname].page/pinned-entity-type-tab-contents.tsx index 4ab6d0bf96b..8c3e9b26666 100644 --- a/apps/hash-frontend/src/pages/@/[shortname].page/pinned-entity-type-tab-contents.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname].page/pinned-entity-type-tab-contents.tsx @@ -37,7 +37,7 @@ import { ProfileSectionHeading } from "../[shortname]/shared/profile-section-hea import type { Org, User } from "../../../lib/user-and-org"; import type { ProfilePageTab } from "./util"; import type { EntityRootType, Subgraph } from "@blockprotocol/graph"; -import type { EntityTypeWithMetadata, WebId } from "@blockprotocol/type-system"; +import type { EntityTypeWithMetadata } from "@blockprotocol/type-system"; import type { HashEntity } from "@local/hash-graph-sdk/entity"; import type { FunctionComponent } from "react"; @@ -139,9 +139,7 @@ export const PinnedEntityTypeTabContents: FunctionComponent<{ const [sortOrder, setSortOrder] = useState("updated-at-desc"); - const webId = ( - profile.kind === "user" ? profile.accountId : profile.webId - ) as WebId; + const webId = profile.kind === "user" ? profile.accountId : profile.webId; const { lastRootPageIndex } = useAccountPages(webId); const [createUntitledPage] = useCreatePage({ diff --git a/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/activity-log.tsx b/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/activity-log.tsx index 9db6df1ac84..42529d8c4ea 100644 --- a/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/activity-log.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/activity-log.tsx @@ -50,7 +50,6 @@ import type { EntityRootType } from "@blockprotocol/graph"; import type { EntityEditionId, EntityId, - EntityMetadata, EntityRecordId, } from "@blockprotocol/type-system"; import type { Filter } from "@local/hash-graph-client"; @@ -101,7 +100,7 @@ const getEntityLabelFromLog = ( entityId: proposedEntity.localEntityId, } satisfies EntityRecordId, entityTypeIds: proposedEntity.entityTypeIds, - } as EntityMetadata, + }, }, true, ); diff --git a/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/outputs/entity-result-table.tsx b/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/outputs/entity-result-table.tsx index 6f1cd2cb12e..77dca44465c 100644 --- a/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/outputs/entity-result-table.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname]/shared/flow-visualizer/outputs/entity-result-table.tsx @@ -511,6 +511,7 @@ export const EntityResultTable = memo( relevance: { header: "Relevance", initialValue: "All", + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: { All: { count: 0, @@ -523,18 +524,21 @@ export const EntityResultTable = memo( status: { header: "Status", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, entityTypeIds: { header: "Type", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, entityLabel: { header: "Name", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, diff --git a/apps/hash-frontend/src/pages/@/[shortname]/types/data-type/[...slug-maybe-version].page.test.tsx b/apps/hash-frontend/src/pages/@/[shortname]/types/data-type/[...slug-maybe-version].page.test.tsx index aa7b87eff36..dffd2d550e0 100644 --- a/apps/hash-frontend/src/pages/@/[shortname]/types/data-type/[...slug-maybe-version].page.test.tsx +++ b/apps/hash-frontend/src/pages/@/[shortname]/types/data-type/[...slug-maybe-version].page.test.tsx @@ -4,7 +4,7 @@ import { describe, expect, test, vi } from "vitest"; import Page from "./[...slug-maybe-version].page"; const router = vi.hoisted(() => ({ - query: {} as Record, + query: {}, asPath: "", })); diff --git a/apps/hash-frontend/src/pages/actions.page/draft-entities/draft-entities-filters.tsx b/apps/hash-frontend/src/pages/actions.page/draft-entities/draft-entities-filters.tsx index ffcde3a3495..4963a82fd7f 100644 --- a/apps/hash-frontend/src/pages/actions.page/draft-entities/draft-entities-filters.tsx +++ b/apps/hash-frontend/src/pages/actions.page/draft-entities/draft-entities-filters.tsx @@ -316,9 +316,7 @@ export const DraftEntitiesFilters: FunctionComponent<{ }, ) .map(({ web, label }) => { - const webWebId = ( - web.kind === "user" ? web.accountId : web.webId - ) as WebId; + const webWebId = web.kind === "user" ? web.accountId : web.webId; return { icon: web.kind === "user" ? : , label, diff --git a/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/dashboard-grid/dashboard-item/dashboard-item-content/world-map-renderer.tsx b/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/dashboard-grid/dashboard-item/dashboard-item-content/world-map-renderer.tsx index b933eae87b8..27b7349e99f 100644 --- a/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/dashboard-grid/dashboard-item/dashboard-item-content/world-map-renderer.tsx +++ b/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/dashboard-grid/dashboard-item/dashboard-item-content/world-map-renderer.tsx @@ -389,7 +389,7 @@ export const WorldMapRenderer = ({ zlevel: 1, }, ], - } as ECOption; + }; }, [flights, isMapReady]); if (!isMapReady) { diff --git a/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/item-config-modal/structural-query-builder.tsx b/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/item-config-modal/structural-query-builder.tsx index b07c8cc7093..9486a85f0a1 100644 --- a/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/item-config-modal/structural-query-builder.tsx +++ b/apps/hash-frontend/src/pages/dashboard/[dashboard-id].page/item-config-modal/structural-query-builder.tsx @@ -253,10 +253,9 @@ const parseCondition = (filter: Filter): ParsedCondition => { }; }; -const buildEntityTypeCondition = (entityTypeBaseUrl: string): Filter => - ({ - equal: [{ path: ["type", "baseUrl"] }, { parameter: entityTypeBaseUrl }], - }) as unknown as Filter; +const buildEntityTypeCondition = (entityTypeBaseUrl: string): Filter => ({ + equal: [{ path: ["type", "baseUrl"] }, { parameter: entityTypeBaseUrl }], +}); const buildPropertyCondition = ({ propertyBaseUrl, @@ -272,13 +271,13 @@ const buildPropertyCondition = ({ const path = ["properties", propertyBaseUrl]; switch (operator) { case "hasAnyValue": - return { exists: { path } } as unknown as Filter; + return { exists: { path } }; case "isEmpty": - return { not: { exists: { path } } } as unknown as Filter; + return { not: { exists: { path } } }; case "isTrue": - return { equal: [{ path }, { parameter: true }] } as unknown as Filter; + return { equal: [{ path }, { parameter: true }] }; case "isFalse": - return { equal: [{ path }, { parameter: false }] } as unknown as Filter; + return { equal: [{ path }, { parameter: false }] }; default: { let parameter: unknown = value; if (kind === "number") { @@ -286,7 +285,7 @@ const buildPropertyCondition = ({ parameter = value.trim() !== "" && !Number.isNaN(numeric) ? numeric : value; } - return { [operator]: [{ path }, { parameter }] } as unknown as Filter; + return { [operator]: [{ path }, { parameter }] }; } } }; @@ -342,7 +341,7 @@ const useBuilderOptions = (): BuilderOptions => { !isSpecialEntityTypeLookup?.[entityType.schema.$id]?.isLink, ) .map((entityType) => ({ - value: entityType.metadata.recordId.baseUrl as string, + value: entityType.metadata.recordId.baseUrl, text: entityType.schema.title, })) .sort((a, b) => a.text.localeCompare(b.text)), @@ -543,7 +542,7 @@ const ExpressionEditor = ({ expression, onChange }: ExpressionEditorProps) => { onChange={(newValue) => onChange({ parameter: parseParameterInput(newValue), - } as FilterExpression) + }) } /> )} @@ -602,14 +601,14 @@ const AdvancedConditionEditor = ({ const { path } = (filter as { exists: { path: unknown[] } }).exists; onChange({ [newOperator]: [{ path }, { parameter: "" }], - } as unknown as Filter); + }); return; } const operands = (filter as unknown as Record)[ operator ]; - onChange({ [newOperator]: operands } as unknown as Filter); + onChange({ [newOperator]: operands }); }; const operatorSelect = ( @@ -655,7 +654,7 @@ const AdvancedConditionEditor = ({ const updateOperand = (index: 0 | 1, expression: FilterExpression) => { const newOperands: FilterExpression[] = [...operands]; newOperands[index] = expression; - onChange({ [operator]: newOperands } as unknown as Filter); + onChange({ [operator]: newOperands }); }; return ( @@ -957,20 +956,20 @@ const FilterNodeEditor = ({ groupKind === "not" ? [] : (filter as unknown as Record<"all" | "any", Filter[]>)[groupKind]; - onChange({ not: children[0] ?? defaultCondition } as Filter); + onChange({ not: children[0] ?? defaultCondition }); return; } if (groupKind === "not") { onChange({ [newKind]: [(filter as { not: Filter }).not], - } as unknown as Filter); + }); return; } onChange({ [newKind]: (filter as unknown as Record<"all" | "any", Filter[]>)[ groupKind ], - } as unknown as Filter); + }); }; const header = ( @@ -1012,7 +1011,7 @@ const FilterNodeEditor = ({ filter={child} depth={depth + 1} options={options} - onChange={(newChild) => onChange({ not: newChild } as Filter)} + onChange={(newChild) => onChange({ not: newChild })} /> @@ -1026,7 +1025,7 @@ const FilterNodeEditor = ({ const updateChild = (index: number, child: Filter) => { const newChildren = [...children]; newChildren[index] = child; - onChange({ [groupKind]: newChildren } as unknown as Filter); + onChange({ [groupKind]: newChildren }); }; return ( @@ -1046,7 +1045,7 @@ const FilterNodeEditor = ({ [groupKind]: children.filter( (_, childIndex) => childIndex !== index, ), - } as unknown as Filter) + }) } /> ))} @@ -1059,7 +1058,7 @@ const FilterNodeEditor = ({ onClick={() => onChange({ [groupKind]: [...children, defaultCondition], - } as unknown as Filter) + }) } > Condition @@ -1072,7 +1071,7 @@ const FilterNodeEditor = ({ onClick={() => onChange({ [groupKind]: [...children, { all: [defaultCondition] }], - } as unknown as Filter) + }) } > Group @@ -1279,8 +1278,7 @@ const useRelationshipOptions = ( { direction: "incoming", linkTypeBaseUrl, - entityTypeBaseUrl: candidateType.metadata.recordId - .baseUrl as string, + entityTypeBaseUrl: candidateType.metadata.recordId.baseUrl, }, ); } diff --git a/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-config.ts b/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-config.ts index d40b08fed7c..a5867df5ce6 100644 --- a/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-config.ts +++ b/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-config.ts @@ -344,7 +344,7 @@ export const useDashboardItemConfig = ({ "https://blockprotocol.org/@blockprotocol/types/data-type/object/v/1", }, }, - } as PropertyPatchOperation); + }); } // Set status to ready diff --git a/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-generations.ts b/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-generations.ts index e7d7673da83..d913290fcd8 100644 --- a/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-generations.ts +++ b/apps/hash-frontend/src/pages/dashboard/hooks/use-dashboard-item-generations.ts @@ -304,7 +304,7 @@ export const useDashboardItemGenerations = ({ "https://blockprotocol.org/@blockprotocol/types/data-type/object/v/1", }, }, - } as PropertyPatchOperation); + }); } propertyPatches.push({ op: "replace", diff --git a/apps/hash-frontend/src/pages/index.page/waitlisted/early-access-modal.tsx b/apps/hash-frontend/src/pages/index.page/waitlisted/early-access-modal.tsx index 294395f3ccb..deea0a7b3f5 100644 --- a/apps/hash-frontend/src/pages/index.page/waitlisted/early-access-modal.tsx +++ b/apps/hash-frontend/src/pages/index.page/waitlisted/early-access-modal.tsx @@ -181,9 +181,8 @@ export const EarlyAccessFormModal = ({ event.preventDefault(); try { - void new URL( - formState["https://hash.ai/@h/types/property-type/website-url/"], - ); + // eslint-disable-next-line no-new -- URL validation throws on invalid input. + new URL(formState["https://hash.ai/@h/types/property-type/website-url/"]); } catch { setUrlError("Please enter a valid URL."); return; diff --git a/apps/hash-frontend/src/pages/notes.page/convert-quick-note-to-page-modal.tsx b/apps/hash-frontend/src/pages/notes.page/convert-quick-note-to-page-modal.tsx index 806d34fc29a..80c96466cb2 100644 --- a/apps/hash-frontend/src/pages/notes.page/convert-quick-note-to-page-modal.tsx +++ b/apps/hash-frontend/src/pages/notes.page/convert-quick-note-to-page-modal.tsx @@ -28,7 +28,7 @@ import type { UpdateEntityMutation, UpdateEntityMutationVariables, } from "../../graphql/api-types.gen"; -import type { BaseUrl, WebId } from "@blockprotocol/type-system"; +import type { BaseUrl } from "@blockprotocol/type-system"; import type { FractionalIndexPropertyValueWithMetadata, PageProperties, @@ -65,7 +65,7 @@ export const ConvertQuickNoteToPageModal: FunctionComponent< const defaultTitle = `Quick Note - ${createdAt.toLocaleString()}`; - const { data: pages } = useAccountPages(authenticatedUser.accountId as WebId); + const { data: pages } = useAccountPages(authenticatedUser.accountId); const [updateEntity] = useMutation< UpdateEntityMutation, @@ -73,7 +73,7 @@ export const ConvertQuickNoteToPageModal: FunctionComponent< >(updateEntityMutation); const { createEntity } = useBlockProtocolCreateEntity( - authenticatedUser.accountId as WebId, + authenticatedUser.accountId, ); const innerSubmit = handleSubmit(async (data) => { diff --git a/apps/hash-frontend/src/pages/notes.page/create-quick-note.tsx b/apps/hash-frontend/src/pages/notes.page/create-quick-note.tsx index 495681b54a6..2e8d87ee5f7 100644 --- a/apps/hash-frontend/src/pages/notes.page/create-quick-note.tsx +++ b/apps/hash-frontend/src/pages/notes.page/create-quick-note.tsx @@ -15,7 +15,6 @@ import { useCreateBlockCollection } from "../shared/use-create-block-collection" import { EditableQuickNote } from "./editable-quick-note"; import type { EntityRootType, Subgraph } from "@blockprotocol/graph"; -import type { WebId } from "@blockprotocol/type-system"; import type { HashEntity } from "@local/hash-graph-sdk/entity"; import type { FunctionComponent } from "react"; @@ -67,7 +66,7 @@ export const CreateQuickNote: FunctionComponent<{ } const { createBlockCollectionEntity } = useCreateBlockCollection({ - webId: authenticatedUser.accountId as WebId, + webId: authenticatedUser.accountId, }); const { getEntity } = useBlockProtocolGetEntity(); diff --git a/apps/hash-frontend/src/pages/notes.page/editable-quick-note.tsx b/apps/hash-frontend/src/pages/notes.page/editable-quick-note.tsx index da6090f62a0..cc5d3106e19 100644 --- a/apps/hash-frontend/src/pages/notes.page/editable-quick-note.tsx +++ b/apps/hash-frontend/src/pages/notes.page/editable-quick-note.tsx @@ -47,7 +47,7 @@ import type { } from "../../graphql/api-types.gen"; import type { PageWithParentLink } from "./convert-quick-note-to-page-modal"; import type { EntityRootType, Subgraph } from "@blockprotocol/graph"; -import type { BaseUrl, WebId } from "@blockprotocol/type-system"; +import type { BaseUrl } from "@blockprotocol/type-system"; import type { BlockCollectionContentItem } from "@local/hash-isomorphic-utils/entity"; import type { ArchivedPropertyValueWithMetadata, @@ -124,7 +124,7 @@ export const EditableQuickNote: FunctionComponent<{ useState(false); const { refetch: refetchPageTree } = useAccountPages( - authenticatedUser.accountId as WebId, + authenticatedUser.accountId, ); const blockCollectionEntityId = quickNoteEntity.metadata.recordId.entityId; @@ -407,7 +407,7 @@ export const EditableQuickNote: FunctionComponent<{ {contents && contents.length > 0 ? ( = ({ const configProperties = extractConfigPropertySchemas(blockSchema ?? {}); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: schema keys are plain strings. const entityData = blockEntity?.blockChildEntity.properties as | JsonObject | undefined; diff --git a/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/block-select-data-modal.tsx b/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/block-select-data-modal.tsx index 46f61a6a54f..16cad2e5e1c 100644 --- a/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/block-select-data-modal.tsx +++ b/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/block-select-data-modal.tsx @@ -31,7 +31,6 @@ import type { BaseUrl, EntityId, PropertyObject, - WebId, } from "@blockprotocol/type-system"; import type { ModalProps } from "@hashintel/design-system"; import type { HashEntity } from "@local/hash-graph-sdk/entity"; @@ -121,7 +120,7 @@ export const BlockSelectDataModal: FunctionComponent< const { authenticatedUser } = useAuthenticatedUser(); const { createEntity } = useBlockProtocolCreateEntity( - authenticatedUser.accountId as WebId, + authenticatedUser.accountId, ); const [updateEntity] = useMutation< diff --git a/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/load-entity-menu-content.tsx b/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/load-entity-menu-content.tsx index 0cfa10534bb..2d11ff6e4d8 100644 --- a/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/load-entity-menu-content.tsx +++ b/apps/hash-frontend/src/pages/shared/block-collection/block-context-menu/load-entity-menu-content.tsx @@ -34,7 +34,6 @@ import type { QueryEntitySubgraphQueryVariables, } from "../../../../graphql/api-types.gen"; import type { EntityId, VersionedUrl } from "@blockprotocol/type-system"; -import type { EntityStoreType } from "@local/hash-isomorphic-utils/entity-store"; import type { PopupState } from "material-ui-popup-state/hooks"; import type { FunctionComponent } from "react"; @@ -105,10 +104,7 @@ export const LoadEntityMenuContent: FunctionComponent< * @todo properly type this part of the DraftEntity type * @see https://linear.app/hash/issue/H-3000 */ - blockView.manager.replaceBlockChildEntity( - blockEntityId, - targetEntity as EntityStoreType, - ); + blockView.manager.replaceBlockChildEntity(blockEntityId, targetEntity); }, [blockView, blockEntityId], ); diff --git a/apps/hash-frontend/src/pages/shared/block-collection/comments/comment-text-field.tsx b/apps/hash-frontend/src/pages/shared/block-collection/comments/comment-text-field.tsx index c587ff4f37b..6897dfb030d 100644 --- a/apps/hash-frontend/src/pages/shared/block-collection/comments/comment-text-field.tsx +++ b/apps/hash-frontend/src/pages/shared/block-collection/comments/comment-text-field.tsx @@ -35,7 +35,6 @@ import { } from "./comment-placeholder-plugin"; import styles from "./style.module.css"; -import type { CommentPlaceholderAction } from "./comment-placeholder-plugin"; import type { TextToken } from "@local/hash-isomorphic-utils/types"; import type { EditorView } from "prosemirror-view"; import type { FunctionComponent } from "react"; @@ -216,7 +215,7 @@ export const CommentTextField: FunctionComponent = ({ const tr = view.state.tr.setMeta(commentPlaceholderPluginkey, { type: "replacePlaceholder", payload: { placeholder }, - } as CommentPlaceholderAction); + }); view.dispatch(tr); } }, [placeholder]); diff --git a/apps/hash-frontend/src/pages/shared/block-collection/component-view.tsx b/apps/hash-frontend/src/pages/shared/block-collection/component-view.tsx index 15cef352cda..fbc8b224fb0 100644 --- a/apps/hash-frontend/src/pages/shared/block-collection/component-view.tsx +++ b/apps/hash-frontend/src/pages/shared/block-collection/component-view.tsx @@ -25,7 +25,6 @@ import { BlockContext } from "./block-context"; import { suggesterPluginKey } from "./create-suggester/create-suggester"; import type { RenderPortal } from "./block-portals"; -import type { SuggesterAction } from "./create-suggester/create-suggester"; import type { EntityId, VersionedUrl } from "@blockprotocol/type-system"; import type { HashBlock } from "@local/hash-isomorphic-utils/blocks"; import type { BlockEntity } from "@local/hash-isomorphic-utils/entity"; @@ -138,7 +137,7 @@ export class ComponentView implements NodeView { this.editorView.state.tr.setMeta(suggesterPluginKey, { type: "suggestedBlock", payload: { position: null }, - } as SuggesterAction), + }), ); } diff --git a/apps/hash-frontend/src/pages/shared/block-collection/create-suggester/create-suggester.tsx b/apps/hash-frontend/src/pages/shared/block-collection/create-suggester/create-suggester.tsx index da5a70cabc0..d0f4f42f86b 100644 --- a/apps/hash-frontend/src/pages/shared/block-collection/create-suggester/create-suggester.tsx +++ b/apps/hash-frontend/src/pages/shared/block-collection/create-suggester/create-suggester.tsx @@ -332,7 +332,7 @@ export const createSuggester = ( tr.setMeta(suggesterPluginKey, { type: "suggestedBlock", payload: { position: componentPosition }, - } as SuggesterAction); + }); view.dispatch(tr); }) diff --git a/apps/hash-frontend/src/pages/shared/claims-table.tsx b/apps/hash-frontend/src/pages/shared/claims-table.tsx index 5440fe15669..d19258ea0fe 100644 --- a/apps/hash-frontend/src/pages/shared/claims-table.tsx +++ b/apps/hash-frontend/src/pages/shared/claims-table.tsx @@ -338,18 +338,21 @@ export const ClaimsTable = memo( status: { header: "Status", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, subject: { header: "Subject", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, object: { header: "Relevant value", initialValue: new Set(), + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- required so that type narrowing below on initialValue works options: {} as VirtualizedTableFilterDefinition["options"], type: "checkboxes", }, diff --git a/apps/hash-frontend/src/pages/shared/data-type/data-type-constraints/shared/enum-editor.tsx b/apps/hash-frontend/src/pages/shared/data-type/data-type-constraints/shared/enum-editor.tsx index 2845511be67..afddf6db9bd 100644 --- a/apps/hash-frontend/src/pages/shared/data-type/data-type-constraints/shared/enum-editor.tsx +++ b/apps/hash-frontend/src/pages/shared/data-type/data-type-constraints/shared/enum-editor.tsx @@ -528,7 +528,8 @@ export const EnumEditor = ({ } if (mergedSchema.format === "uri") { try { - void new URL(value); + // eslint-disable-next-line no-new -- URL validation throws on invalid input. + new URL(value); } catch { setError(`constraints.enum.${index}`, { message: "Value must be a valid URL", diff --git a/apps/hash-frontend/src/pages/shared/entities-visualizer/entities-table.tsx b/apps/hash-frontend/src/pages/shared/entities-visualizer/entities-table.tsx index 5ae354e5b02..4666d8ef8f9 100644 --- a/apps/hash-frontend/src/pages/shared/entities-visualizer/entities-table.tsx +++ b/apps/hash-frontend/src/pages/shared/entities-visualizer/entities-table.tsx @@ -540,7 +540,7 @@ export const EntitiesTable: FunctionComponent<{ columnId === "sourceEntity" || columnId === "targetEntity" ) { - const entity = row[columnId] as EntitiesTableRow["sourceEntity"]; + const entity = row[columnId]; if (!entity) { const data = "Does not apply"; return { diff --git a/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/displays-files-only.test.ts b/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/displays-files-only.test.ts index ee2e76f6b33..11037d68f0e 100644 --- a/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/displays-files-only.test.ts +++ b/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/displays-files-only.test.ts @@ -29,7 +29,7 @@ const lookup = ( typeId, { isFile, isImage: false, isLink: false }, ]), - ) as Record; + ); const fileLookup = lookup({ [fileTypeId]: true, diff --git a/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/property-filters/derive-filterable-properties.ts b/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/property-filters/derive-filterable-properties.ts index e597f29bef9..9a0bbc45ed7 100644 --- a/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/property-filters/derive-filterable-properties.ts +++ b/apps/hash-frontend/src/pages/shared/entities-visualizer/shared/property-filters/derive-filterable-properties.ts @@ -130,7 +130,7 @@ const resolveStringEnumOptions = ({ ) { return null; } - const candidates = (constraints as { enum: unknown }).enum; + const candidates = constraints.enum; return Array.isArray(candidates) && candidates.length > 0 && candidates.every( diff --git a/apps/hash-frontend/src/pages/shared/entities-visualizer/use-entities-table-query/generate-table-data-from-endpoint-rows.browser.test.ts b/apps/hash-frontend/src/pages/shared/entities-visualizer/use-entities-table-query/generate-table-data-from-endpoint-rows.browser.test.ts index 9257d0d9e1c..b157d1117fa 100644 --- a/apps/hash-frontend/src/pages/shared/entities-visualizer/use-entities-table-query/generate-table-data-from-endpoint-rows.browser.test.ts +++ b/apps/hash-frontend/src/pages/shared/entities-visualizer/use-entities-table-query/generate-table-data-from-endpoint-rows.browser.test.ts @@ -215,7 +215,7 @@ describe("generateTableDataFromEndpointRows", () => { definitions: { ...definitions, propertyTypes: {}, - } as unknown as EntityTypeResolveDefinitions, + }, endpointRows: [row("1", { name: "Alice" })], }), ).toThrow(/Property type not found/); diff --git a/apps/hash-frontend/src/pages/shared/entity-type-page/edit-bar-type-editor.test.tsx b/apps/hash-frontend/src/pages/shared/entity-type-page/edit-bar-type-editor.test.tsx index 18e469f816e..382ee439757 100644 --- a/apps/hash-frontend/src/pages/shared/entity-type-page/edit-bar-type-editor.test.tsx +++ b/apps/hash-frontend/src/pages/shared/entity-type-page/edit-bar-type-editor.test.tsx @@ -8,7 +8,7 @@ import { EditBarTypeEditor } from "./edit-bar-type-editor"; import type { ReactNode } from "react"; const formState = vi.hoisted(() => ({ - dirtyFields: {} as Record, + dirtyFields: {}, isSubmitting: false, })); diff --git a/apps/hash-frontend/src/pages/shared/entity-type-page/use-entity-type-dependents.ts b/apps/hash-frontend/src/pages/shared/entity-type-page/use-entity-type-dependents.ts index 3db7945281a..86af53deeb2 100644 --- a/apps/hash-frontend/src/pages/shared/entity-type-page/use-entity-type-dependents.ts +++ b/apps/hash-frontend/src/pages/shared/entity-type-page/use-entity-type-dependents.ts @@ -112,7 +112,7 @@ export const useGetEntityTypeDependents = (): { const userWebs = useMemo(() => { return [ - authenticatedUser.accountId as WebId, + authenticatedUser.accountId, ...authenticatedUser.memberOf.map(({ org }) => org.webId), ]; }, [authenticatedUser]); diff --git a/apps/hash-frontend/src/pages/shared/entity/entity-editor/history-section/history-table/shared/event-detail.tsx b/apps/hash-frontend/src/pages/shared/entity/entity-editor/history-section/history-table/shared/event-detail.tsx index eb1758f9478..9c1a6023db1 100644 --- a/apps/hash-frontend/src/pages/shared/entity/entity-editor/history-section/history-table/shared/event-detail.tsx +++ b/apps/hash-frontend/src/pages/shared/entity/entity-editor/history-section/history-table/shared/event-detail.tsx @@ -11,7 +11,7 @@ import { stringifyPropertyValue } from "@local/hash-isomorphic-utils/stringify-p import { ValueChip } from "../../../../../value-chip"; import type { HistoryEvent } from "../../shared/types"; -import type { EntityRootType, Subgraph } from "@blockprotocol/graph"; +import type { Subgraph } from "@blockprotocol/graph"; const createValueText = (value: PropertyValue, metadata: PropertyMetadata) => { if (isValueMetadata(metadata)) { @@ -38,10 +38,7 @@ export const EventDetail = ({ }) => { switch (event.type) { case "created": { - const entityLabel = generateEntityLabel( - subgraph as Subgraph, - event.entity, - ); + const entityLabel = generateEntityLabel(subgraph, event.entity); return ( <> {entityLabel} diff --git a/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/create-draft-link-entity.ts b/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/create-draft-link-entity.ts index 398703b84c1..8699bc1ea49 100644 --- a/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/create-draft-link-entity.ts +++ b/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/create-draft-link-entity.ts @@ -1,11 +1,7 @@ import { currentTimestamp } from "@blockprotocol/type-system"; import { HashEntity } from "@local/hash-graph-sdk/entity"; -import type { - ActorEntityUuid, - EntityId, - VersionedUrl, -} from "@blockprotocol/type-system"; +import type { EntityId, VersionedUrl } from "@blockprotocol/type-system"; /** * @todo - This is unsafe, and should be refactored to return a new type `DraftEntity`, so that we aren't @@ -30,11 +26,11 @@ export const createDraftLinkEntity = ({ recordId: { editionId: "", entityId: `draft~${Date.now()}` as EntityId }, entityTypeIds: [linkEntityTypeId], provenance: { - createdById: "" as ActorEntityUuid, + createdById: "", createdAtTransactionTime: currentTimestamp(), createdAtDecisionTime: currentTimestamp(), edition: { - createdById: "" as ActorEntityUuid, + createdById: "", actorType: "user", origin: { type: "api" }, }, diff --git a/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/linked-entity-selector.tsx b/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/linked-entity-selector.tsx index 79d7a0b1a92..e105256eae1 100644 --- a/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/linked-entity-selector.tsx +++ b/apps/hash-frontend/src/pages/shared/entity/entity-editor/links-section/outgoing-links-section/cells/linked-with-cell/linked-entity-selector.tsx @@ -148,7 +148,7 @@ export const LinkedEntitySelector = ({ ] ?? "File"; - onSelect(upload.createdEntities.fileEntity as HashEntity, label); + onSelect(upload.createdEntities.fileEntity, label); }, webId: activeWorkspaceWebId, /** diff --git a/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/cells/value-cell/editor-type-picker.test.tsx b/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/cells/value-cell/editor-type-picker.test.tsx index aacb7667f94..123cf3091d0 100644 --- a/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/cells/value-cell/editor-type-picker.test.tsx +++ b/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/cells/value-cell/editor-type-picker.test.tsx @@ -42,7 +42,7 @@ beforeAll(() => { observe() {} unobserve() {} - } as unknown as typeof ResizeObserver; + }; HTMLElement.prototype.scrollIntoView = scrollIntoView; }); diff --git a/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/use-rows/use-property-rows-from-entity.ts b/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/use-rows/use-property-rows-from-entity.ts index f6db77dd07f..8604099ae51 100644 --- a/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/use-rows/use-property-rows-from-entity.ts +++ b/apps/hash-frontend/src/pages/shared/entity/entity-editor/properties-section/property-table/use-rows/use-property-rows-from-entity.ts @@ -79,7 +79,7 @@ export const usePropertyRowsFromEntity = (): PropertyRow[] => { return typedKeys(closedMultiEntityType.properties).flatMap( (propertyTypeBaseUrl) => { - if (processedPropertyTypes.has(propertyTypeBaseUrl as BaseUrl)) { + if (processedPropertyTypes.has(propertyTypeBaseUrl)) { return []; } @@ -90,14 +90,14 @@ export const usePropertyRowsFromEntity = (): PropertyRow[] => { throw new Error(`Property ${propertyTypeBaseUrl} not found`); } - processedPropertyTypes.add(propertyTypeBaseUrl as BaseUrl); + processedPropertyTypes.add(propertyTypeBaseUrl); return generatePropertyRowRecursively({ closedMultiEntityType, closedMultiEntityTypesDefinitions, generateNewMetadataObject, - propertyTypeBaseUrl: propertyTypeBaseUrl as BaseUrl, - propertyKeyChain: [propertyTypeBaseUrl as BaseUrl], + propertyTypeBaseUrl, + propertyKeyChain: [propertyTypeBaseUrl], entity, requiredPropertyTypes: (closedMultiEntityType.required as BaseUrl[] | undefined) ?? [], diff --git a/apps/hash-frontend/src/pages/shared/entity/query-editor.tsx b/apps/hash-frontend/src/pages/shared/entity/query-editor.tsx index 067b6bc9691..33d897753c5 100644 --- a/apps/hash-frontend/src/pages/shared/entity/query-editor.tsx +++ b/apps/hash-frontend/src/pages/shared/entity/query-editor.tsx @@ -19,7 +19,6 @@ import { EntityHeader } from "./entity-header"; import type { EntityEditorProps } from "./entity-editor"; import type { MultiFilter } from "@blockprotocol/graph"; -import type { Entity as EntityBp } from "@blockprotocol/type-system"; interface QueryEditorProps extends EntityEditorProps { handleSaveQuery: (value: MultiFilter) => Promise; @@ -73,7 +72,7 @@ export const QueryEditor = (props: QueryEditorProps) => { throw new Error(res.errors?.[0]?.message ?? "Unknown error"); } - return getRoots(res.data.results) as EntityBp[]; + return getRoots(res.data.results); }, [queryEntities], ); diff --git a/apps/hash-frontend/src/pages/shared/filter-bar/use-internal-webs.ts b/apps/hash-frontend/src/pages/shared/filter-bar/use-internal-webs.ts index 21c70792916..f97473d15a1 100644 --- a/apps/hash-frontend/src/pages/shared/filter-bar/use-internal-webs.ts +++ b/apps/hash-frontend/src/pages/shared/filter-bar/use-internal-webs.ts @@ -2,7 +2,6 @@ import { useMemoCompare } from "../../../shared/use-memo-compare"; import { useAuthenticatedUser } from "../auth-info-context"; import type { InternalWeb } from "./web-filter-pill"; -import type { WebId } from "@blockprotocol/type-system"; /** * The authenticated user's own and org webs for the web filter pill, with a @@ -14,7 +13,7 @@ export const useInternalWebs = (): InternalWeb[] => { return useMemoCompare( () => [ { - webId: authenticatedUser.accountId as WebId, + webId: authenticatedUser.accountId, name: `@${authenticatedUser.shortname}`, }, ...authenticatedUser.memberOf.map(({ org }) => ({ diff --git a/apps/hash-frontend/src/pages/shared/web-selector.tsx b/apps/hash-frontend/src/pages/shared/web-selector.tsx index c148a354708..2d968813391 100644 --- a/apps/hash-frontend/src/pages/shared/web-selector.tsx +++ b/apps/hash-frontend/src/pages/shared/web-selector.tsx @@ -79,7 +79,7 @@ export const WebSelector = ({ /> ), label: "My web", - value: authenticatedUser.accountId as WebId, + value: authenticatedUser.accountId, }, ...authenticatedUser.memberOf.map( ({ org: { webId, name, hasAvatar } }) => ({ diff --git a/apps/hash-frontend/src/pages/shared/workspace-context-provider.tsx b/apps/hash-frontend/src/pages/shared/workspace-context-provider.tsx index ecb1c162e84..1a9bc4df586 100644 --- a/apps/hash-frontend/src/pages/shared/workspace-context-provider.tsx +++ b/apps/hash-frontend/src/pages/shared/workspace-context-provider.tsx @@ -41,7 +41,7 @@ export const WorkspaceContextProvider: FunctionComponent<{ } else if (authenticatedUser) { const defaultWorkspaceWebId = authenticatedUser.memberOf[0]?.org.webId ?? - (authenticatedUser.accountId as WebId); + authenticatedUser.accountId; /** * Initialize the `activeWorkspaceWebId` to the first organization the @@ -70,8 +70,7 @@ export const WorkspaceContextProvider: FunctionComponent<{ */ if (activeWorkspaceWebId && authenticatedUser && !activeWorkspace) { updateActiveWorkspaceWebId( - authenticatedUser.memberOf[0]?.org.webId ?? - (authenticatedUser.accountId as WebId), + authenticatedUser.memberOf[0]?.org.webId ?? authenticatedUser.accountId, ); } }, [ diff --git a/apps/hash-frontend/src/pages/signin.page.tsx b/apps/hash-frontend/src/pages/signin.page.tsx index 1938bde9f16..07d2164c4d1 100644 --- a/apps/hash-frontend/src/pages/signin.page.tsx +++ b/apps/hash-frontend/src/pages/signin.page.tsx @@ -27,7 +27,6 @@ import { WorkspaceContext } from "./shared/workspace-context"; import type { NextPageWithLayout } from "../shared/layout"; import type { ButtonProps } from "../shared/ui"; -import type { WebId } from "@blockprotocol/type-system"; import type { LoginFlow } from "@ory/client"; import type { AxiosError } from "axios"; import type { FormEventHandler } from "react"; @@ -255,7 +254,7 @@ const SigninPage: NextPageWithLayout = () => { throw new Error("Could not fetch authenticated user after logging in."); } - updateActiveWorkspaceWebId(authenticatedUser.accountId as WebId); + updateActiveWorkspaceWebId(authenticatedUser.accountId); void router.push( returnTo ?? getSafeReturnToPath(activeFlow.return_to) ?? "/", ); diff --git a/apps/hash-frontend/src/pages/supply-chain/shared/data.ts b/apps/hash-frontend/src/pages/supply-chain/shared/data.ts index 63e57b17e22..2f88728c2b7 100644 --- a/apps/hash-frontend/src/pages/supply-chain/shared/data.ts +++ b/apps/hash-frontend/src/pages/supply-chain/shared/data.ts @@ -115,9 +115,7 @@ const getActiveWebId = (): WebId => { }; export function fetchProducts(): Promise { - productsCache = - productsCache ?? - (fetchAnalysisProducts(getActiveWebId()) as Promise); + productsCache = productsCache ?? fetchAnalysisProducts(getActiveWebId()); return productsCache; } diff --git a/apps/hash-frontend/src/pages/supply-chain/shared/status-dialog/status-editor.test.tsx b/apps/hash-frontend/src/pages/supply-chain/shared/status-dialog/status-editor.test.tsx index 189b5f927a0..e6422a3cf9a 100644 --- a/apps/hash-frontend/src/pages/supply-chain/shared/status-dialog/status-editor.test.tsx +++ b/apps/hash-frontend/src/pages/supply-chain/shared/status-dialog/status-editor.test.tsx @@ -25,7 +25,7 @@ beforeAll(() => { observe() {} unobserve() {} - } as unknown as typeof ResizeObserver; + }; HTMLElement.prototype.scrollIntoView = scrollIntoView; Range.prototype.getClientRects = () => [] as unknown as DOMRectList; Range.prototype.getBoundingClientRect = () => diff --git a/apps/hash-frontend/src/pages/supply-chain/shared/step-detail-panel/data-table-section.tsx b/apps/hash-frontend/src/pages/supply-chain/shared/step-detail-panel/data-table-section.tsx index a9358e5130c..298ee1a72d2 100644 --- a/apps/hash-frontend/src/pages/supply-chain/shared/step-detail-panel/data-table-section.tsx +++ b/apps/hash-frontend/src/pages/supply-chain/shared/step-detail-panel/data-table-section.tsx @@ -506,7 +506,7 @@ export const DataTableSection = forwardRef< if (!detailRows?.rows) { return []; } - return detailRows.rows as Record[]; + return detailRows.rows; }, [detailRows]); const table = useReactTable({ data, @@ -690,6 +690,7 @@ export const DataTableSection = forwardRef< {table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: ColumnMeta omits our numeric flag. const meta = header.column.columnDef.meta as | { numeric?: boolean } | undefined; @@ -744,6 +745,7 @@ export const DataTableSection = forwardRef< {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: ColumnMeta omits our numeric flag. const meta = cell.column.columnDef.meta as | { numeric?: boolean } | undefined; diff --git a/apps/hash-frontend/src/pages/supply-chain/shared/use-search-params.ts b/apps/hash-frontend/src/pages/supply-chain/shared/use-search-params.ts index 5bb235c1621..3e830d554fa 100644 --- a/apps/hash-frontend/src/pages/supply-chain/shared/use-search-params.ts +++ b/apps/hash-frontend/src/pages/supply-chain/shared/use-search-params.ts @@ -66,7 +66,7 @@ export function useSearchParams(): [URLSearchParams, SetURLSearchParams] { const resolved = typeof nextInit === "function" ? nextInit(new URLSearchParams(optimisticQueryString)) - : new URLSearchParams(nextInit as Record | undefined); + : new URLSearchParams(nextInit); const path = router.asPath.split("?")[0]; if (!path) { diff --git a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/process-graph.tsx b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/process-graph.tsx index dd1ca02dec1..a64dacb0f20 100644 --- a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/process-graph.tsx +++ b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/process-graph.tsx @@ -24,7 +24,7 @@ import { StepNode } from "./process-graph/step-node"; import type { GraphData, GraphNode, GraphEdge } from "../../shared/types"; const nodeTypes: NodeTypes = { - stepNode: StepNode as unknown as NodeTypes[string], + stepNode: StepNode, }; const canvasShell = css({ @@ -242,9 +242,7 @@ export const ProcessGraph = ({ const containerCallbackRef = useCallback( (el: HTMLDivElement | null) => { if (el) { - ( - containerRef as React.MutableRefObject - ).current = el; + containerRef.current = el; el.addEventListener("fullscreenchange", onFullscreenChange); } }, diff --git a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule.test.tsx b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule.test.tsx index 6f3f9ce8a9a..d6d4cf535b0 100644 --- a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule.test.tsx +++ b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule.test.tsx @@ -1358,30 +1358,28 @@ describe("ProductionScheduleView", () => { clientHeight: { configurable: true, value: 600 }, clientWidth: { configurable: true, value: 800 }, }); - frame.getBoundingClientRect = () => - ({ - bottom: 600, - height: 600, - left: 0, - right: 800, - top: 0, - width: 800, - x: 0, - y: 0, - toJSON: () => ({}), - }) as DOMRect; - batch.getBoundingClientRect = () => - ({ - bottom: 430, - height: 30, - left: 600, - right: 700, - top: 400, - width: 100, - x: 600, - y: 400, - toJSON: () => ({}), - }) as DOMRect; + frame.getBoundingClientRect = () => ({ + bottom: 600, + height: 600, + left: 0, + right: 800, + top: 0, + width: 800, + x: 0, + y: 0, + toJSON: () => ({}), + }); + batch.getBoundingClientRect = () => ({ + bottom: 430, + height: 30, + left: 600, + right: 700, + top: 400, + width: 100, + x: 600, + y: 400, + toJSON: () => ({}), + }); fireEvent.change( screen.getByRole("searchbox", { diff --git a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule/timeline-tooltip.test.tsx b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule/timeline-tooltip.test.tsx index 33dfaeed81c..8c5a157aa3f 100644 --- a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule/timeline-tooltip.test.tsx +++ b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/product/production-schedule/timeline-tooltip.test.tsx @@ -9,18 +9,17 @@ const rect = ( top: number, width: number, height: number, -): DOMRect => - ({ - bottom: top + height, - height, - left, - right: left + width, - top, - width, - x: left, - y: top, - toJSON: () => ({}), - }) as DOMRect; +): DOMRect => ({ + bottom: top + height, + height, + left, + right: left + width, + top, + width, + x: left, + y: top, + toJSON: () => ({}), +}); afterEach(() => { vi.restoreAllMocks(); diff --git a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/site/shared/supply-chain-filters/operators.ts b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/site/shared/supply-chain-filters/operators.ts index 6ad1c257835..81e53ff8d87 100644 --- a/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/site/shared/supply-chain-filters/operators.ts +++ b/apps/hash-frontend/src/pages/supply-chain/supply-chain-data-shell/site/shared/supply-chain-filters/operators.ts @@ -96,7 +96,7 @@ export const pickOperators = < keys: ReadonlyArray, ): SupplyChainFilterOperator[] => keys.flatMap((key) => { - const config = map[key] as OperatorConfig | undefined; + const config = map[key]; return config ? [{ key, label: config.label, input: config.input }] : []; }); diff --git a/apps/hash-frontend/src/pages/types/external/entity-type/[...base64-baseurl-maybe-version].page.test.tsx b/apps/hash-frontend/src/pages/types/external/entity-type/[...base64-baseurl-maybe-version].page.test.tsx index d9a1d89f350..75a0556122a 100644 --- a/apps/hash-frontend/src/pages/types/external/entity-type/[...base64-baseurl-maybe-version].page.test.tsx +++ b/apps/hash-frontend/src/pages/types/external/entity-type/[...base64-baseurl-maybe-version].page.test.tsx @@ -4,7 +4,7 @@ import { describe, expect, test, vi } from "vitest"; import Page from "./[...base64-baseurl-maybe-version].page"; const router = vi.hoisted(() => ({ - query: {} as Record, + query: {}, asPath: "", })); diff --git a/apps/hash-frontend/src/shared/layout/layout-with-sidebar/sidebar/workspace-switcher.tsx b/apps/hash-frontend/src/shared/layout/layout-with-sidebar/sidebar/workspace-switcher.tsx index 77ce44a90e6..bef221cabd7 100644 --- a/apps/hash-frontend/src/shared/layout/layout-with-sidebar/sidebar/workspace-switcher.tsx +++ b/apps/hash-frontend/src/shared/layout/layout-with-sidebar/sidebar/workspace-switcher.tsx @@ -24,8 +24,6 @@ import { getImageUrlFromEntityProperties } from "../../../../pages/shared/get-fi import { useActiveWorkspace } from "../../../../pages/shared/workspace-context"; import { Button, MenuItem } from "../../../ui"; -import type { WebId } from "@blockprotocol/type-system"; - export const WorkspaceSwitcher = () => { const popupState = usePopupState({ variant: "popover", @@ -77,7 +75,7 @@ export const WorkspaceSwitcher = () => { const workspaceList = useMemo(() => { return [ { - webId: authenticatedUser.accountId as WebId, + webId: authenticatedUser.accountId, title: "My personal workspace", subText: `@${authenticatedUser.shortname ?? "user"}`, avatarTitle: authenticatedUser.displayName ?? "U", diff --git a/apps/hash-integration-worker/src/activities/flow-activities/shared/split-properties-and-metadata.ts b/apps/hash-integration-worker/src/activities/flow-activities/shared/split-properties-and-metadata.ts index 0cb10fc58a0..80f86959785 100644 --- a/apps/hash-integration-worker/src/activities/flow-activities/shared/split-properties-and-metadata.ts +++ b/apps/hash-integration-worker/src/activities/flow-activities/shared/split-properties-and-metadata.ts @@ -9,7 +9,6 @@ import type { PropertyObject, PropertyObjectMetadata, PropertyValue, - PropertyValueMetadata, PropertyWithMetadata, } from "@blockprotocol/type-system"; @@ -34,7 +33,7 @@ const extractPropertyValue = ( if (Array.isArray(propertyWithMetadata.value)) { return propertyWithMetadata.value.map((element) => extractPropertyValue(element as PropertyWithMetadata), - ) as PropertyValue; + ); } // Check if it's an object (PropertyObjectWithMetadata) @@ -50,7 +49,7 @@ const extractPropertyValue = ( key, extractPropertyValue(value as PropertyWithMetadata), ]), - ) as PropertyValue; + ); } } @@ -74,7 +73,7 @@ const extractPropertyMetadata = ( // This is a PropertyValueWithMetadata return { metadata: propertyWithMetadata.metadata, - } as PropertyValueMetadata; + }; } // Check if it's an array @@ -127,7 +126,7 @@ const extractPropertyMetadata = ( // Fallback: return value metadata with null dataTypeId return { metadata: { dataTypeId: null }, - } as PropertyValueMetadata; + }; }; /** diff --git a/apps/petrinaut-docs/package.json b/apps/petrinaut-docs/package.json index d64367cbd9d..9647fc19f82 100644 --- a/apps/petrinaut-docs/package.json +++ b/apps/petrinaut-docs/package.json @@ -31,7 +31,7 @@ "@types/react": "19.2.14", "@types/react-dom": "19.2.3", "hast-util-from-html": "2.0.3", - "typescript": "catalog:", + "typescript": "catalog:typescript6", "unist-util-visit": "5.1.0" }, "engines": { diff --git a/apps/petrinaut-website/api/tsconfig.json b/apps/petrinaut-website/api/tsconfig.json index 67e65429def..c85f3d3b3d3 100644 --- a/apps/petrinaut-website/api/tsconfig.json +++ b/apps/petrinaut-website/api/tsconfig.json @@ -6,6 +6,7 @@ "lib": ["DOM", "ESNext"], "moduleResolution": "NodeNext", "noEmit": true, + "rootDir": "..", "verbatimModuleSyntax": true }, "include": ["./**/*.ts"] diff --git a/apps/petrinaut-website/package.json b/apps/petrinaut-website/package.json index 37fd49a4c3c..bdb42298cf8 100644 --- a/apps/petrinaut-website/package.json +++ b/apps/petrinaut-website/package.json @@ -11,7 +11,7 @@ "fix:eslint": "oxlint --fix --type-aware --report-unused-disable-directives-severity=error .", "generate:icons": "node scripts/generate-favicons.mjs", "lint:eslint": "oxlint --type-aware --report-unused-disable-directives-severity=error .", - "lint:tsc": "tsgo --noEmit && tsgo --noEmit --project api/tsconfig.json", + "lint:tsc": "tsc --noEmit && tsc --noEmit --project api/tsconfig.json", "preview": "vite preview", "test:unit": "vitest run --passWithNoTests" }, @@ -50,7 +50,6 @@ "@types/node": "catalog:", "@types/react": "19.2.14", "@types/react-dom": "19.2.3", - "@typescript/native-preview": "7.0.0-dev.20260511.1", "@typescript/typescript6": "catalog:", "@vitejs/plugin-react": "6.1.1", "@whatwg-node/server": "0.10.18", @@ -60,6 +59,7 @@ "oxlint": "1.86.0", "oxlint-tsgolint": "7.0.2003", "sharp": "0.35.5", + "typescript": "catalog:", "vite": "catalog:", "vitest": "catalog:" } diff --git a/apps/plugin-browser/package.json b/apps/plugin-browser/package.json index 1441b6f5315..da995fbe277 100644 --- a/apps/plugin-browser/package.json +++ b/apps/plugin-browser/package.json @@ -67,6 +67,7 @@ "@types/react-dom": "19.2.3", "@types/webextension-polyfill": "0.12.4", "@types/ws": "8.18.1", + "@typescript/typescript6": "catalog:", "babel-loader": "10.0.0", "babel-preset-react-app": "10.1.0", "copy-webpack-plugin": "14.0.0", @@ -79,17 +80,17 @@ "html-webpack-plugin": "5.6.4", "process": "0.11.10", "react-refresh": "0.18.0", - "react-refresh-typescript": "2.0.11", + "react-refresh-typescript": "2.0.12", "rimraf": "6.1.3", "sass": "1.93.2", "sass-loader": "13.3.3", "source-map-loader": "3.0.2", "style-loader": "3.3.4", "terser-webpack-plugin": "5.4.0", - "ts-loader": "9.5.4", + "ts-loader": "9.6.2", "type-fest": "5.3.1", "typescript": "catalog:", - "webpack": "5.104.1", + "webpack": "5.107.2", "webpack-cli": "6.0.1", "webpack-dev-server": "5.2.6", "zip-webpack-plugin": "4.0.3" diff --git a/apps/plugin-browser/tsconfig.json b/apps/plugin-browser/tsconfig.json index 6606754c39c..e496b54a4a8 100644 --- a/apps/plugin-browser/tsconfig.json +++ b/apps/plugin-browser/tsconfig.json @@ -2,8 +2,9 @@ "extends": ["@tsconfig/bases/recommended", "@local/tsconfig/policy.json"], "compilerOptions": { "jsx": "react-jsx", - "lib": ["dom", "esnext"], + "lib": ["dom", "dom.iterable", "esnext"], "module": "ESNext", + "noEmit": false, "rootDir": "../..", "target": "ES2021" }, diff --git a/apps/plugin-browser/webpack.config.js b/apps/plugin-browser/webpack.config.js index 0ee81c12049..1a8883d6cd8 100755 --- a/apps/plugin-browser/webpack.config.js +++ b/apps/plugin-browser/webpack.config.js @@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url"; import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"; import { sentryWebpackPlugin } from "@sentry/webpack-plugin"; +import ts from "@typescript/typescript6"; import CopyWebpackPlugin from "copy-webpack-plugin"; import dotenv from "dotenv-flow"; import fileSystem from "fs-extra"; @@ -124,10 +125,14 @@ const options = { { loader: "ts-loader", options: { + // The loader and Refresh need the JS API, while standalone checks use native TS7. + compiler: fileURLToPath( + import.meta.resolve("@typescript/typescript6"), + ), getCustomTransformers: () => ({ - before: [isDevelopment && ReactRefreshTypeScript()].filter( - Boolean, - ), + before: [ + isDevelopment && ReactRefreshTypeScript({ ts }), + ].filter(Boolean), }), transpileOnly: isDevelopment, }, diff --git a/libs/@blockprotocol/graph/package.json b/libs/@blockprotocol/graph/package.json index 97ebf8193b6..7e63f1f6727 100644 --- a/libs/@blockprotocol/graph/package.json +++ b/libs/@blockprotocol/graph/package.json @@ -71,12 +71,12 @@ "dependencies": { "@blockprotocol/core": "0.1.5", "@blockprotocol/type-system": "workspace:^", + "@typescript/typescript6": "catalog:", "ajv": "8.18.0", "ajv-formats": "3.0.1", "dequal": "2.0.3", "json-schema-to-typescript": "15.0.4", - "lit": "2.8.0", - "typescript": "catalog:" + "lit": "2.8.0" }, "devDependencies": { "@apidevtools/json-schema-ref-parser": "15.1.3", diff --git a/libs/@blockprotocol/graph/src/codegen/preprocess/transform-type-titles.ts b/libs/@blockprotocol/graph/src/codegen/preprocess/transform-type-titles.ts index 10f0b8232b2..688e972bf91 100644 --- a/libs/@blockprotocol/graph/src/codegen/preprocess/transform-type-titles.ts +++ b/libs/@blockprotocol/graph/src/codegen/preprocess/transform-type-titles.ts @@ -1,4 +1,4 @@ -import ts from "typescript"; +import ts from "@typescript/typescript6"; import { extractBaseUrl, extractVersion } from "@blockprotocol/type-system"; diff --git a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/entity-type.ts b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/entity-type.ts index ce79a993a2b..d2b034e6f70 100644 --- a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/entity-type.ts +++ b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/entity-type.ts @@ -66,6 +66,7 @@ export const getEntityTypesReferencedByEntityType = ( revisionId = entityTypeId.revisionId; } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: type is narrowed beforehand to make sure that indexing results in the right type const outwardEdges = (subgraph.edges as OntologyRootedEdges)[baseUrl]?.[ revisionId ]; diff --git a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/link-entity.ts b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/link-entity.ts index e442790124f..d0425462c78 100644 --- a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/link-entity.ts +++ b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/link-entity.ts @@ -63,6 +63,7 @@ export const getOutgoingLinksForEntity = ( const searchInterval = interval ?? getLatestInstantIntervalForSubgraph(subgraph); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: type is narrowed beforehand to make sure that indexing results in the right type const entityEdges = (subgraph.edges as KnowledgeGraphRootedEdges)[entityId]; if (!entityEdges) { @@ -135,6 +136,7 @@ export const getIncomingLinksForEntity = ( const searchInterval = interval ?? getLatestInstantIntervalForSubgraph(subgraph); + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: type is narrowed beforehand to make sure that indexing results in the right type const entityEdges = (subgraph.edges as KnowledgeGraphRootedEdges)[entityId]; if (!entityEdges) { @@ -206,9 +208,7 @@ export const getLeftEntityForLinkEntity = ( const searchInterval = interval ?? getLatestInstantIntervalForSubgraph(subgraph); - const outwardEdge = Object.values( - (subgraph.edges as KnowledgeGraphRootedEdges)[entityId] ?? {}, - ) + const outwardEdge = Object.values(subgraph.edges[entityId] ?? {}) .flat() .find(isHasLeftEntityEdge); @@ -257,9 +257,7 @@ export const getRightEntityForLinkEntity = ( const searchInterval = interval ?? getLatestInstantIntervalForSubgraph(subgraph); - const outwardEdge = Object.values( - (subgraph.edges as KnowledgeGraphRootedEdges)[entityId] ?? {}, - ) + const outwardEdge = Object.values(subgraph.edges[entityId] ?? {}) .flat() .find(isHasRightEntityEdge); diff --git a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/shared.ts b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/shared.ts index d219d09e7c8..091321111ce 100644 --- a/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/shared.ts +++ b/libs/@blockprotocol/graph/src/stdlib/subgraph/edge/shared.ts @@ -40,6 +40,7 @@ export const getOntologyEndpointsForOntologyOutwardEdge = ( revisionId = ontologyTypeId.revisionId; } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- false positive: type is narrowed beforehand to make sure that indexing results in the right type const outwardEdges = (subgraph.edges as OntologyRootedEdges)[baseUrl]?.[ revisionId ]; diff --git a/libs/@blockprotocol/graph/src/stdlib/subgraph/roots.ts b/libs/@blockprotocol/graph/src/stdlib/subgraph/roots.ts index 121e01cd7ed..f2363955a0c 100644 --- a/libs/@blockprotocol/graph/src/stdlib/subgraph/roots.ts +++ b/libs/@blockprotocol/graph/src/stdlib/subgraph/roots.ts @@ -46,7 +46,7 @@ export const getRoots = ( )} was missing`, ); - return root.inner as RootType["element"]; + return root.inner; }); /** diff --git a/libs/@blockprotocol/graph/src/util/typed-entries.ts b/libs/@blockprotocol/graph/src/util/typed-entries.ts index 683e3f23437..a6d6cee265e 100644 --- a/libs/@blockprotocol/graph/src/util/typed-entries.ts +++ b/libs/@blockprotocol/graph/src/util/typed-entries.ts @@ -39,7 +39,7 @@ export function typedEntries>( export const typedKeys = >( object: T, ): Entry[0][] => { - return Object.keys(object) as Entry[0][]; + return Object.keys(object); }; /** `Object.values` analogue which returns a well-typed array */ diff --git a/libs/@blockprotocol/type-system/typescript/eslint.config.js b/libs/@blockprotocol/type-system/typescript/eslint.config.js index ff595171892..e4aac2d3e1d 100644 --- a/libs/@blockprotocol/type-system/typescript/eslint.config.js +++ b/libs/@blockprotocol/type-system/typescript/eslint.config.js @@ -3,7 +3,7 @@ import { createBase } from "@local/eslint/deprecated"; export default [ ...createBase(import.meta.dirname), { - ignores: ["rollup.config.js"], + ignores: ["rolldown.config.js"], }, { rules: { diff --git a/libs/@blockprotocol/type-system/typescript/package.json b/libs/@blockprotocol/type-system/typescript/package.json index d881c27365a..6b719adf57a 100644 --- a/libs/@blockprotocol/type-system/typescript/package.json +++ b/libs/@blockprotocol/type-system/typescript/package.json @@ -23,7 +23,7 @@ "typesVersions": { "*": { "*": [ - "./dist/es-slim/main.d.ts" + "./dist/es/main.d.ts" ], "slim": [ "./dist/es-slim/main-slim.d.ts" @@ -39,7 +39,7 @@ "./wasm": "./dist/wasm/type-system.wasm" }, "scripts": { - "build": "yarn clean && rollup -c --bundleConfigAsCjs", + "build": "yarn clean && rolldown -c && tsc --project tsconfig.dist.json", "build:pack": "node ../../../../scripts/check-package-payload.mjs", "clean": "rimraf ./dist/", "codegen": "node scripts/copy-generated.ts", @@ -58,9 +58,6 @@ "@local/eslint": "workspace:*", "@local/hash-codec": "workspace:*", "@local/tsconfig": "workspace:*", - "@rollup/plugin-commonjs": "29.0.0", - "@rollup/plugin-node-resolve": "16.0.3", - "@rollup/plugin-typescript": "12.3.0", "@rollup/plugin-wasm": "6.2.2", "@tsconfig/bases": "catalog:", "@types/node": "catalog:", @@ -70,7 +67,8 @@ "eslint": "9.39.4", "react": "19.2.6", "rimraf": "6.1.3", - "rollup": "4.59.0", + "rolldown": "1.2.6", + "rolldown-plugin-dts": "0.28.3", "tslib": "2.8.1", "typescript": "catalog:", "vite-plugin-wasm-pack": "0.1.12", diff --git a/libs/@blockprotocol/type-system/typescript/rolldown.config.js b/libs/@blockprotocol/type-system/typescript/rolldown.config.js new file mode 100644 index 00000000000..d78df0e72ff --- /dev/null +++ b/libs/@blockprotocol/type-system/typescript/rolldown.config.js @@ -0,0 +1,68 @@ +import fs from "node:fs"; +import path from "node:path"; + +import { wasm } from "@rollup/plugin-wasm"; +import { defineConfig } from "rolldown"; +import { dts } from "rolldown-plugin-dts"; + +const production = !process.env.ROLLDOWN_WATCH; + +const bundles = [ + { input: "src/main.ts", outputDirectory: "dist/es", inlineWasm: true }, + { + input: "src/main-slim.ts", + outputDirectory: "dist/es-slim", + inlineWasm: false, + }, +]; + +export default defineConfig( + bundles.map(({ input, outputDirectory, inlineWasm }) => ({ + input, + output: { + dir: outputDirectory, + format: "es", + entryFileNames: "[name].js", + sourcemap: !production, + }, + plugins: [ + inlineWasm && wasm({ targetEnv: "auto-inline" }), + dts({ generator: "tsgo", tsconfig: "./tsconfig.build.json" }), + { + name: "check-public-imports", + generateBundle(_options, bundle) { + for (const chunk of Object.values(bundle)) { + if (chunk.type !== "chunk") { + continue; + } + + for (const importedModule of [ + ...chunk.imports, + ...chunk.dynamicImports, + ]) { + if (importedModule.startsWith("@local/")) { + this.error( + `${chunk.fileName} imports from unpublished package ${importedModule}`, + ); + } + } + } + }, + }, + { + name: "copy-wasm", + generateBundle() { + fs.mkdirSync(path.resolve("dist/wasm"), { recursive: true }); + fs.copyFileSync( + path.resolve("../rust/pkg/type-system_bg.wasm"), + path.resolve("dist/wasm/type-system.wasm"), + ); + fs.copyFileSync( + path.resolve("../rust/pkg/type-system_bg.wasm.d.ts"), + path.resolve("dist/wasm/type-system.wasm.d.ts"), + ); + }, + }, + ], + })), +); diff --git a/libs/@blockprotocol/type-system/typescript/rollup.config.js b/libs/@blockprotocol/type-system/typescript/rollup.config.js deleted file mode 100644 index 33913ec20fb..00000000000 --- a/libs/@blockprotocol/type-system/typescript/rollup.config.js +++ /dev/null @@ -1,85 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; - -import commonjs from "@rollup/plugin-commonjs"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import typescript from "@rollup/plugin-typescript"; -import { wasm } from "@rollup/plugin-wasm"; - -const production = !process.env.ROLLUP_WATCH; - -const outdir = (fmt, env) => { - if (env === "node") { - return `dist/node`; - } else { - return `dist/${fmt}${env === "slim" ? "-slim" : ""}`; - } -}; - -const rolls = (fmt, env) => ({ - input: env !== "slim" ? "src/main.ts" : "src/main-slim.ts", - output: { - dir: outdir(fmt, env), - format: fmt, - entryFileNames: `[name].js`, - name: "type-system", - sourcemap: !production, - }, - plugins: [ - // We want to inline our wasm bundle as base64 on non-slim builds. - env !== "slim" ? wasm({ targetEnv: "auto-inline" }) : undefined, - typescript({ - declaration: true, - declarationDir: outdir(fmt, env), - outDir: outdir(fmt, env), - rootDir: "src", - sourceMap: !production, - inlineSources: !production, - outputToFilesystem: false, - }), - nodeResolve(), - commonjs(), - { - name: "copy-pkg", - resolveImportMeta: () => `""`, - generateBundle() { - fs.mkdirSync(path.resolve(`dist/wasm`), { recursive: true }); - - fs.copyFileSync( - path.resolve("../rust/pkg/type-system_bg.wasm"), - path.resolve("dist/wasm/type-system.wasm"), - ); - fs.copyFileSync( - path.resolve("../rust/pkg/type-system_bg.wasm.d.ts"), - path.resolve("dist/wasm/type-system.wasm.d.ts"), - ); - - // `src/generated` holds declaration files, which TypeScript passes over rather than - // emitting. Without this copy the re-exports in the emitted `main.d.ts` dangle. - const generatedDir = path.resolve(outdir(fmt, env), "generated"); - fs.mkdirSync(generatedDir, { recursive: true }); - - for (const file of fs.readdirSync(path.resolve("src/generated"))) { - // `Real` is the only type the generated declarations pull from another crate. Inlining - // it keeps the published package free of a dependency on the unpublished `hash-codec`. - const content = fs - .readFileSync(path.resolve("src/generated", file), "utf8") - .replace( - 'import type { Real } from "@local/hash-codec/types";', - "type Real = number;", - ); - - if (content.includes('from "@local/')) { - this.error( - `${file} imports from an unpublished \`@local/\` package`, - ); - } - - fs.writeFileSync(path.join(generatedDir, file), content); - } - }, - }, - ], -}); - -export default [rolls("es", "fat"), rolls("es", "slim")]; diff --git a/libs/@blockprotocol/type-system/typescript/src/native/entity.ts b/libs/@blockprotocol/type-system/typescript/src/native/entity.ts index 853f338dab1..46185751666 100644 --- a/libs/@blockprotocol/type-system/typescript/src/native/entity.ts +++ b/libs/@blockprotocol/type-system/typescript/src/native/entity.ts @@ -102,7 +102,7 @@ export const splitEntityId = ( return [webId as WebId, entityUuid as EntityUuid, draftId as DraftId]; }; -export const stripDraftIdFromEntityId = (entityId: EntityId) => { +export const stripDraftIdFromEntityId = (entityId: EntityId): EntityId => { const [webId, entityUuid] = splitEntityId(entityId); return entityIdFromComponents(webId, entityUuid); }; diff --git a/libs/@blockprotocol/type-system/typescript/src/native/url.ts b/libs/@blockprotocol/type-system/typescript/src/native/url.ts index 7b0b1f86639..85f36fa1d9e 100644 --- a/libs/@blockprotocol/type-system/typescript/src/native/url.ts +++ b/libs/@blockprotocol/type-system/typescript/src/native/url.ts @@ -29,7 +29,8 @@ export const validateBaseUrl = ( }; } try { - void new URL(url); + // eslint-disable-next-line no-new -- The constructor validates by throwing; its result is unused. + new URL(url); if (url.endsWith("/")) { return { type: "Ok", diff --git a/libs/@blockprotocol/type-system/typescript/test/url.test.ts b/libs/@blockprotocol/type-system/typescript/test/url.test.ts index 4594a64d5dd..61555805203 100644 --- a/libs/@blockprotocol/type-system/typescript/test/url.test.ts +++ b/libs/@blockprotocol/type-system/typescript/test/url.test.ts @@ -115,19 +115,16 @@ describe("makeOntologyTypeVersion", () => { }); const extractBaseUrlCases: [VersionedUrl, BaseUrl][] = [ - ["http://example.com/v/1" as VersionedUrl, "http://example.com/" as BaseUrl], + ["http://example.com/v/1", "http://example.com/" as BaseUrl], [ - "http://example.com/sandwich/v/1" as VersionedUrl, + "http://example.com/sandwich/v/1", "http://example.com/sandwich/" as BaseUrl, ], [ - "file://localhost/documents/myfolder/v/10" as VersionedUrl, + "file://localhost/documents/myfolder/v/10", "file://localhost/documents/myfolder/" as BaseUrl, ], - [ - "ftp://rms@example.com/foo/v/5" as VersionedUrl, - "ftp://rms@example.com/foo/" as BaseUrl, - ], + ["ftp://rms@example.com/foo/v/5", "ftp://rms@example.com/foo/" as BaseUrl], ]; describe("extractBaseUrl", () => { @@ -140,10 +137,10 @@ describe("extractBaseUrl", () => { }); const extractVersionCases: [VersionedUrl, string][] = [ - ["http://example.com/v/1" as VersionedUrl, "1"], - ["http://example.com/sandwich/v/1" as VersionedUrl, "1"], - ["file://localhost/documents/myfolder/v/10" as VersionedUrl, "10"], - ["ftp://rms@example.com/foo/v/5" as VersionedUrl, "5"], + ["http://example.com/v/1", "1"], + ["http://example.com/sandwich/v/1", "1"], + ["file://localhost/documents/myfolder/v/10", "10"], + ["ftp://rms@example.com/foo/v/5", "5"], ]; describe("extractVersion", () => { @@ -194,15 +191,9 @@ describe("Draft version support", () => { }); describe("extractVersion with drafts", () => { - test.each([ - [ - "http://example.com/v/1-draft.abc12345.1" as VersionedUrl, - "1-draft.abc12345.1", - ], - [ - "http://example.com/v/2-draft.xyz98765.999" as VersionedUrl, - "2-draft.xyz98765.999", - ], + test.each<[VersionedUrl, string]>([ + ["http://example.com/v/1-draft.abc12345.1", "1-draft.abc12345.1"], + ["http://example.com/v/2-draft.xyz98765.999", "2-draft.xyz98765.999"], ])("extractVersion(%s) returns draft version", (input, expected) => { expect(extractVersion(input).toString()).toEqual(expected); }); diff --git a/libs/@blockprotocol/type-system/typescript/tsconfig.build.json b/libs/@blockprotocol/type-system/typescript/tsconfig.build.json new file mode 100644 index 00000000000..9cc88c2872e --- /dev/null +++ b/libs/@blockprotocol/type-system/typescript/tsconfig.build.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["src"], + "compilerOptions": { + "rootDir": "src" + } +} diff --git a/libs/@blockprotocol/type-system/typescript/tsconfig.dist.json b/libs/@blockprotocol/type-system/typescript/tsconfig.dist.json new file mode 100644 index 00000000000..fb220548d8a --- /dev/null +++ b/libs/@blockprotocol/type-system/typescript/tsconfig.dist.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "include": ["dist/**/*.d.ts"], + "exclude": [], + "compilerOptions": { + "noEmit": true, + "skipLibCheck": false, + "types": [] + } +} diff --git a/libs/@hashintel/brunch-agent/package.json b/libs/@hashintel/brunch-agent/package.json index 229a4f1ad27..9c637512e67 100644 --- a/libs/@hashintel/brunch-agent/package.json +++ b/libs/@hashintel/brunch-agent/package.json @@ -26,7 +26,7 @@ "build": "vite build", "fix:eslint": "oxlint --fix --type-aware --type-check --report-unused-disable-directives-severity=error .", "lint:eslint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error .", - "lint:tsc": "tsgo --noEmit", + "lint:tsc": "tsc --noEmit", "test:unit": "vitest run" }, "dependencies": { @@ -40,9 +40,9 @@ "@local/tsconfig": "workspace:*", "@tsconfig/bases": "catalog:", "@types/node": "catalog:", - "@typescript/native-preview": "7.0.0-dev.20260511.1", "oxlint": "1.86.0", "oxlint-tsgolint": "7.0.2003", + "typescript": "catalog:", "vite": "catalog:", "vitest": "catalog:" } diff --git a/libs/@hashintel/design-system/src/data-type-selector.tsx b/libs/@hashintel/design-system/src/data-type-selector.tsx index 4f8ec470261..df2fbb829de 100644 --- a/libs/@hashintel/design-system/src/data-type-selector.tsx +++ b/libs/@hashintel/design-system/src/data-type-selector.tsx @@ -529,7 +529,7 @@ export const DataTypeSelector = (props: DataTypeSelectorProps) => { onFocus={() => setTextFieldFocused(true)} onBlur={(event) => { const isMenuClick = popoverRef.current?.contains( - event.relatedTarget as Node, + event.relatedTarget, ); if (!isMenuClick) { diff --git a/libs/@hashintel/design-system/src/theme.ts b/libs/@hashintel/design-system/src/theme.ts index d18699f3ff9..73c66edee2e 100644 --- a/libs/@hashintel/design-system/src/theme.ts +++ b/libs/@hashintel/design-system/src/theme.ts @@ -7,8 +7,6 @@ import { palette } from "./theme/palette"; import { boxShadows, dropShadows, shadows } from "./theme/shadows"; import { typography } from "./theme/typography"; -import type { ThemeOptions } from "@mui/material"; - export const theme = createTheme({ palette, typography, @@ -17,7 +15,7 @@ export const theme = createTheme({ boxShadows, dropShadows, /** @todo: figure out how to properly override this type */ - components: components as ThemeOptions["components"], + components, }); export const createEmotionCache = (key?: string) => diff --git a/libs/@hashintel/ds-components/eslint.config.js b/libs/@hashintel/ds-components/eslint.config.js index 8d8ae54d54e..4d83ea5140a 100644 --- a/libs/@hashintel/ds-components/eslint.config.js +++ b/libs/@hashintel/ds-components/eslint.config.js @@ -1,7 +1,5 @@ -import typescriptEslint from "@typescript-eslint/eslint-plugin"; -import reactHooks from "eslint-plugin-react-hooks"; - import { createBase, disableRules } from "@local/eslint/deprecated"; +import { reactHooks, typescriptEslint } from "@local/eslint/plugins"; const disableTypeCheckedRules = typescriptEslint.configs["disable-type-checked"]?.rules ?? {}; diff --git a/libs/@hashintel/ds-components/src/components/Avatar/avatar.tsx b/libs/@hashintel/ds-components/src/components/Avatar/avatar.tsx index b139f918760..325c18addf0 100644 --- a/libs/@hashintel/ds-components/src/components/Avatar/avatar.tsx +++ b/libs/@hashintel/ds-components/src/components/Avatar/avatar.tsx @@ -139,26 +139,19 @@ export const Avatar = ({ }; if (asLink) { - return ( - )}> - {content} - - ); + return {content}; } if (asButton) { return ( - ); } return ( -
)} role="img"> +
{content}
); diff --git a/libs/@hashintel/ds-components/src/components/Banner/banner.tsx b/libs/@hashintel/ds-components/src/components/Banner/banner.tsx index c4939e7bce2..907ef5e7752 100644 --- a/libs/@hashintel/ds-components/src/components/Banner/banner.tsx +++ b/libs/@hashintel/ds-components/src/components/Banner/banner.tsx @@ -128,7 +128,7 @@ export const BannerActionButton = ({ }: ButtonProps) => (