Skip to content

PublishParameters message type too strict #412

@yo1dog

Description

@yo1dog

It looks like the Payload type used by PublishParameters.message attempts to ensure the value contains only valid JSON types, but using this type on inputs prevents users from utilizing the JSON serialization layer. Namely, classes/objects with custom JSON serialization via toJSON(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#tojson_behavior

For example, instances of Date. Another example is that undefined is not allowed even though JSON serialization excludes those properties automatically.

I suggest using unknown instead of Payload.

The workaround is to use the any trapdoor which defeats the purpose of the typing entirely.

Metadata

Metadata

Assignees

Labels

priority: lowThis PR should be reviewed after all high and medium PRs.status: in progressThis issue is being worked on.type: refactorThis PR contains refactored existing features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions