Skip to content

Date field types in TCollabThread are incorrect when used with Tiptap Collaboration #928

@soren121

Description

@soren121

Description

The TypeScript types for TCollabThread in @hocuspocus/provider are inaccurate. The date fields (createdAt, updatedAt, deletedAt, and resolvedAt) are typed as number, but the collaboration service returns ISO 8601 strings for these fields.

As a result, I cannot parse these dates correctly in TypeScript without ugly casts (e.g. thread.createdAt as unknown as string).

Steps to reproduce the bug

  1. Using the Tiptap Comments extension, create a new thread.
  2. Retrieve the threads using the subscribeToThreads function from @tiptap-pro/extension-comments.
  3. In the callback, observe the data values of the threads items with console.log or the debugger.
  4. Note that the date fields are strings, and not numbers as typed.

Expected behavior

I expect the data to match the specified type.

Screenshot, video, or GIF

Image

Environment?

  • operating system: macOS
  • browser: Firefox 137.0.2
  • mobile/desktop: Desktop
  • Hocuspocus version: 2.15.2

Additional context

We are using Collaboration Server 3.46.3 (on-premises).

I'm not sure whether to file this bug against Hocuspocus or the Collaboration Server.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions