Skip to content

[OP-20346] Frontend typings: query and API payloads - #25663

Open
myabc wants to merge 24 commits into
implementation/op-20349-eslint-typing-fix-hal-index-signaturefrom
implementation/op-20346-eslint-typing-fix-query-payloads
Open

myabc wants to merge 24 commits into
implementation/op-20349-eslint-typing-fix-hal-index-signaturefrom
implementation/op-20346-eslint-typing-fix-query-payloads

Conversation

@myabc

@myabc myabc commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/OP-20346

What are you trying to accomplish?

Part of OP-20341: removes ESLint typing violations from query URL parameters, query form payloads, the APIv3 caches, new work package breadcrumbs and board action query params, without changing behaviour.

The scoped files go from 36 typing violations to 0; application-code typing violations drop from 531 to 495.

What approach did you choose and why?

A QueryFormPayload interface describes the raw JSON posted to the query form endpoint, with a link bag that holds single links or arrays of links, reusing HalSourceLink. The graph configuration's queryCreationParams now returns it, since its result feeds the typed form loader.

All changes are annotations or boundary casts; every changed file transpiles to the same JavaScript. The URL helper's identity map calls stay as they are: replacing them with a spread would split a malformed string parameter into characters instead of failing.

Stacked on #25661, which makes the HalResource index signature unknown. Independent of #25662.

AI involvement

Directed – I specified the requirements and AI implemented most of it; I validated via testing rather than a full line-by-line review.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)
Browser JavaScript diff: none

Every change in this pull request is type-only: transpiling each changed file with the project's compiler settings produces identical JavaScript before and after.

Turns off no-explicit-any and the no-unsafe-* rules for specs and the
test helpers that are kept out of the production bundle. Test doubles
and expectation helpers routinely work with loosely typed values, and
the typing effort under OP-20341 targets application code only.

The two no-unsafe exemptions that lived in the vitest spec block move
into the new block, which covers the helper files as well.

Removes the inline disables in specs and test setup that the exemption
makes redundant.

https://community.openproject.org/wp/OP-20342
Removes the api.v3 Result, Collection and Duration interfaces, the
Factory global and the op.QueryParams namespace. Nothing references
them, and most declared their members as any.

https://community.openproject.org/wp/OP-20342
Declares the tablesorter call and its language defaults, and the
metadata plugin slot the reporting page clears, instead of any. The
reporting controller no longer needs its inline disables for them.

https://community.openproject.org/wp/OP-20342
Adds a HookSignatures map for the hooks the core registers and calls,
so register and call check callback parameters and return typed
results instead of any. Arbitrary hook names still fall back to an
open signature, because plugins register and call hooks by name.
The fallback excludes the known names, so a mismatched callback or
argument for a known hook fails to compile; the spec pins that down.

The bulk context menu actions are now declared as WorkPackageAction,
which the typed hook result exposed as narrower than its use.

https://community.openproject.org/wp/OP-20342
Types the dynamic component output maps with ng-dynamic-component's
EventHandler, which is what ndcDynamicOutputs accepts, and the checksum
callback as a plain thunk. The unconstrained Function type accepted
any callable and let calls through unchecked.

https://community.openproject.org/wp/OP-20342
Deletes WorkPackageResource#updateLinkedResources. It has no callers
and calls an undeclared wpCacheService, so it only compiled because
of the resource's `any` index signature.

https://community.openproject.org/wp/OP-20344
Makes HalLink#$fetch and #$callable generic and gives CallableHalLink
its call signature and a HalLink-typed $link, so link functions no
longer rely on the global `Function.$link?:any` augmentation, which is
removed.

HalResource#$links is now a map of CallableHalLink and #$embedded a map
of unknown values. Resource-specific link interfaces declare their
action links as CallableHalLink<T> instead of `Promise<any>` methods,
and are intersected with the base maps on `$links`/`$embedded` so the
resource interfaces they are merged into keep the `any` index
signature until it is flipped separately.

WorkPackageResourceEmbedded drops its `HalResource|any` unions and the
link interface no longer inherits the embedded attributes. The unused
QueryFilterResource embedded declaration is removed.

Callers that relied on the untyped maps get boundary casts.

https://community.openproject.org/wp/OP-20344
Types HalResource#$source as HalSource and accepts an unknown source in
the constructor and $initialize, which already unwrap a HalResource
passed in place of a raw source. The initializer callback takes a
HalResource, $copy and $plain drop their `any`, and lazy() becomes
generic over the value it defines.

initializeHalProperties now reads the source through typed views of
`_links` and `_embedded` and passes the target maps to setupProperty
directly instead of looking them up by a computed `$`-name, removing
the builder's `any` casts. Runtime behaviour is unchanged.

Callers and specs that relied on the untyped source get boundary
casts.

https://community.openproject.org/wp/OP-20344
Types ResourceChangeset#schema and WorkPackageChangeset#schema as
ISchemaProxy, which is what both getters return. FormResource#schema
stays the embedded form schema and gets its own FormSchemaResource
type, a SchemaResource whose attributes are field schemas, and its
commit link becomes a CallableHalLink.

IFieldSchema is now derived from IOPFieldSchema instead of duplicating
it with `any`-typed allowedValues and options. Fields that load
allowed values through the link cast it at the boundary.

SchemaProxy dispatches its proxied methods by name through
proxyMethod, which keeps them bound to the handler and still honours
subclass overrides, instead of wrapping unbound method references in a
Function proxy. The payload helper checks own schema keys with
Object.hasOwn.

https://community.openproject.org/wp/OP-20344
Declares attributes and link callables that callers already read
through the `any` index signature: FormResource#payload, #commit and
#configureForm, QueryResource#star, #unstar, #icalUrl and #updatedAt,
TimeEntryResource#hours, WorkPackageCollectionResource#customFields
and #createWorkPackage, and WorkPackageResource#configureForm and
#bcfViewpoints. WorkPackageResource#description becomes Formattable and
RelationResource#type a string.

Class and interface declaration merges are replaced by member
declarations on the class (with `implements` for the exported shape),
which emit no code under useDefineForClassFields: false. Resource
state getters cast through unknown instead of `any`.

Callers whose values are now typed get boundary casts.

https://community.openproject.org/wp/OP-20344
Types the request data, created sources and registered classes in
HalResourceService, the HTTP client options and interceptor, and
ErrorResource's errors and details. HalResourceNotificationService
takes ErrorResource where it reads error attributes and treats raw
responses as unknown.

HalError#resource is nullable, so the two callers passing it to
showError assert it at the boundary, as the service already assumed.

HTTPClientParamMap keeps its `any` values: query and BCF callers pass
untyped objects as request params.

https://community.openproject.org/wp/OP-20344
Types the remaining `any` members of the query filter, filter schema,
schema dependency and grid resources, lets attachable resources read
the now typed addAttachment link directly, and casts the two schema
and parent reads that go through the resource index signature.

https://community.openproject.org/wp/OP-20344
Removes type assertions, eslint-disable directives and imports that
the typed HAL links, sources, schemas and resource attributes made
unnecessary, and marks the two now typed $load() calls whose promises
were already discarded with `void`.

https://community.openproject.org/wp/OP-20344
Declares the base link map as holding a callable link, an array of
links, or nothing, since the builder resolves array-valued HAL links
to arrays and resources only carry the links the API sent. The self
link is always present, as the builder creates one when missing.

Call sites that read a link they have already checked, or that the
resource always carries, cast it at the point of use.

https://community.openproject.org/wp/OP-20344
Casts the resource attributes that display and edit fields read by
name at the point of use, keeping today's values. These reads compiled
only because HalResource declared an any index signature, which the
next commit removes.

https://community.openproject.org/wp/OP-20349
Casts work package attributes and raw links that views and services
read without a declared type, keeping today's behaviour, ahead of the
HalResource index signature becoming unknown.

https://community.openproject.org/wp/OP-20349
Casts undeclared resource attributes read in grids, context menus,
modals, search, BCF, the team planner and the costs and GitLab plugin
modules, keeping today's behaviour, ahead of the HalResource index
signature becoming unknown.

https://community.openproject.org/wp/OP-20349
Casts the resource attribute a spec reads by name, since specs are
typechecked even though they are exempt from the typing lint rules.

https://community.openproject.org/wp/OP-20349
Declares the HalResource index signature as unknown instead of any.
The any signature let every undeclared attribute read skip type
checking, which a code comment had tracked as a source of bugs since
2019 (#31462). Reads of undeclared attributes now need a declaration
or a cast, as the preceding commits add.

The payload helper picks the current schema with ?? instead of ||; the
value is a schema resource or nullish, so the result is unchanged.

https://community.openproject.org/wp/OP-20349
Types the query string builder input as an object and lets the decoded
query props flow through their declared string types instead of
re-annotating callback parameters as any. Types the query param
listener's change stream as the checksum it emits.

https://community.openproject.org/wp/OP-20346
Declares a QueryFormPayload interface for the raw JSON posted to the
query form endpoint, with a link bag that accepts single links and
link arrays such as sortBy. The graph widget's creation params now
return that type so they still satisfy the typed parameter.

https://community.openproject.org/wp/OP-20346
Replaces the any casts where cached APIv3 collections and the state
cache hand HAL responses to their generic cache type. The casts go
through unknown or the type parameter directly, keeping the existing
assumption that the response matches the cached type.

https://community.openproject.org/wp/OP-20346
Declares the breadcrumb list as BreadcrumbItem[] instead of letting it
evolve into any[], matching the work package view page. Asserts the
current project name as present inside the identifier check, as that
page already does.

https://community.openproject.org/wp/OP-20346
Lets the board action query params infer their object type instead of
declaring them as any, since addQuery only needs an object. Casts the
synthetic unassigned user to HalResource once where it is declared,
which is how every consumer already treats it.

https://community.openproject.org/wp/OP-20346
@myabc
myabc force-pushed the implementation/op-20349-eslint-typing-fix-hal-index-signature branch from ac71ea0 to 2705f0a Compare September 29, 2026 09:47
@myabc
myabc force-pushed the implementation/op-20346-eslint-typing-fix-query-payloads branch from f192a80 to c8ef60e Compare September 29, 2026 09:47
@myabc myabc added eslint javascript Pull requests that update Javascript code labels Sep 29, 2026
@myabc myabc added this to the 18.0.x milestone Sep 29, 2026
@github-actions github-actions Bot added the ai: Directed 🪄 A human specified the requirements and AI implemented most of it; They validated via testing. label Sep 29, 2026
@myabc
myabc requested a lite review from Copilot September 29, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

What changed in this PR

This PR removes frontend typing violations around query payloads, URL parameters, breadcrumbs, board actions, and API cache updates without changing runtime behavior.

Changes:

  • Introduces QueryFormPayload for query form requests.
  • Replaces any annotations with concrete or inferred types.
  • Updates cache/resource casts for the stricter HAL typings.
File Description
frontend/​src/​app/​shared/​components/​work-package-graphs/​configuration/​wp-graph-configuration.ts Updated as part of this pull request.
frontend/​src/​app/​features/​work-packages/​components/​wp-query/​url-params-helper.ts Updated as part of this pull request.
frontend/​src/​app/​features/​work-packages/​components/​wp-new/​wp-new-full-view.component.ts Updated as part of this pull request.
frontend/​src/​app/​features/​boards/​board/​board-actions/​board-action.service.ts Updated as part of this pull request.
frontend/​src/​app/​features/​boards/​board/​board-actions/​assignee/​assignee-action.service.ts Updated as part of this pull request.
frontend/​src/​app/​core/​apiv3/​endpoints/​queries/​apiv3-query-form.ts Updated as part of this pull request.
frontend/​src/​app/​core/​apiv3/​cache/​state-cache.service.ts Updated as part of this pull request.
frontend/​src/​app/​core/​apiv3/​cache/​cachable-apiv3-collection.ts Updated as part of this pull request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@myabc
myabc marked this pull request as ready for review September 29, 2026 10:22
@myabc
myabc force-pushed the implementation/op-20349-eslint-typing-fix-hal-index-signature branch from 2705f0a to cdd9389 Compare September 29, 2026 18:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai: Directed 🪄 A human specified the requirements and AI implemented most of it; They validated via testing. eslint javascript Pull requests that update Javascript code needs review

Development

Successfully merging this pull request may close these issues.

2 participants