Skip to content

spec extraction: attribute array/tuple & nested destructuring of factory-returned ApiNamespaces #552

Description

@osama-rizk

Follow-up from PR #522 (#444).

extractMethodTypes (packages/core/src/scripts/extract-ts-types.ts) attributes a factory-returned ApiNamespace to its namespace only for a top-level identifier or a shallow object binding pattern. Array/tuple patterns and nested destructuring fall through to the bare-key path:

const [ns] = factory();        // array/tuple pattern → bare key only
const { a: { b } } = factory(); // nested → bare key only

Today this is fail-soft: the schema is still recovered under the bare method name, and generate-spec's #498 fallback resolves it when there is no method-name collision. But if a factory returns a tuple of namespaces with a colliding method name (e.g. const [a, b] = factory() where both expose create), that path would hit the #445 class of cross-assignment again.

Documented as an accepted boundary in extract-ts-types.test.ts ('array/nested destructuring falls through to the bare key'). Filing so the comment can link a tracked follow-up.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions