deepgram / deepgram-js-sdk

Official JavaScript SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
127 stars 45 forks source link

Use type instead of interface #272

Open ryanleecode opened 1 month ago

ryanleecode commented 1 month ago

Proposed changes

Using interface for base types causes a lot of bullshit when it comes to generics trying to consume this type because of index signatures.

All the interface signatures should be converted to type

Context

https://www.totaltypescript.com/type-vs-interface-which-should-you-use

For example the current type signatues cause a lot of problems when trying to make it a deserialization JSON type

type JsonPrimitive = string | number | boolean | null | undefined | Date | symbol;
type JsonArray = Json[];
type JsonRecord<T> = {
    [Property in keyof T]: Json;
};
type Json<T = any> = JsonPrimitive | JsonArray | JsonRecord<T>;
lukeocodes commented 1 month ago

@ryanleecode can you spell out exactly what it is that is not working?