Skip to content

Add Typescript Support #116

@chestercharles

Description

@chestercharles

Proposal
As more projects integrate Typescript, it would be nice if the @synapsestudios/fetch-client provided types so that developers can get type safety and intellisense on the inputs and outputs of the client methods.

What should be typed?

  • all client method arguments (including options) and return types.
  • the client.addPlugin method. We should also export aClientPlugin type so developers can build against that interface.
  • the client itself should have a type. It should take type parameters in such a way that we can properly expose helper methods that the developer expects to be accessible on the client.

How do we do this?
There are a few possible options

  1. Re-write the library in TypeScript
  2. Create Typescript declaration files that live alongside our JavaScript

Option 1 is the most work, but provides a better guarantee that the types provided by the library are correct. Option 2 is less work, but there is more risk that declared types will not be correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or a major change to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions