prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

fix: restore `@prismicio/client` integration #46

Closed angeloashmore closed 1 year ago

angeloashmore commented 1 year ago

Types of changes

Description

This PR fixes a bug where the @prismicio/client integration would return any for all client query methods.

This only occurs when @prismicio/types is used as the types provider (the default). Both @prismicio/types and @prismicio/client were imported as prismic, causing a type error. Without a resolvable type, TypeScript returns any.

// Output before
import type * as prismic from "@prismicio/types";
import type * as prismic from "@prismicio/client"; // Conflict!

// Output after
import type * as prismic from "@prismicio/types";
import type * as prismicClient from "@prismicio/client";

Note that when @prismicio/client is the types provider, only a single import is generated, resulting in no error.

import type * as prismic from "@prismicio/client";

Checklist: