Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore previous explicit document type parameter handling (fixes #246) #247

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

angeloashmore
Copy link
Member

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This fixes a regression introduced in #238 that prevented explicit doucment type parameters to be accepted. This includes cases that appear like the following:

import * as prismic from "@prismicio/client";
import * as prismicT from "@prismicio/types";

type PageDocument = prismicT.PrismicDocument<
  { foo: prismicT.KeyTextField },
  "page"
>;

const client = prismic.createClient("qwerty");

const home = await client.getByUID<PageDocument>("page", "home");
//    ^ Typed as `PageDocument`

Before this PR, home would be typed as prismicT.PrismicDocument when it should be PageDocument.

Fixes #246

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

@codecov-commenter
Copy link

Codecov Report

Merging #247 (909fac5) into master (00572af) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #247   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files          23       23           
  Lines         377      377           
  Branches       76       76           
=======================================
  Hits          375      375           
  Partials        2        2           
Impacted Files Coverage Δ
src/client.ts 99.10% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00572af...909fac5. Read the comment docs.

@github-actions
Copy link

size-limit report 📦

Path Size
dist/index.js 4.1 KB (0%)
dist/index.cjs 7 KB (0%)

@angeloashmore angeloashmore changed the title fix: restore previous explicit document type paramter handling (fixes #246) fix: restore previous explicit document type parameter handling (fixes #246) Jun 22, 2022
@angeloashmore angeloashmore merged commit 6a33564 into master Jun 22, 2022
@angeloashmore angeloashmore deleted the aa/fix-document-type-resolution branch June 22, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Types issues with getByUIDs method
2 participants