ts-plus / typescript

Apache License 2.0
37 stars 5 forks source link

Add support for json annotation that indicates a particular value should be a companion/type #263

Open patroza opened 1 year ago

patroza commented 1 year ago

If there is a const in a module, how do I mark that one as a type/companion in tsplus json definitions? Basically @effect/io/Scope now has a const Scope which is a Tag<Scope, Scope>, so the companion part of

    {
      "definitionName": "Scope",
      "definitionKind": "interface",
      "extensions": [
        {
          "kind": "type",
          "typeName": "effect/io/Scope"
        },
        {
          "kind": "companion",
          "typeName": "effect/io/Scope.Ops"
        }
      ]
    }

no longer works 🙂 the way I would've done it manually in the source would be:

/* @tsplus type @effect/io/Scope.Ops */
export interface ScopeOps extends Tag<Scope, Scope> {}
export const Scope: ScopeOps = Tag<Scope>()