prismicio / prismic-types

Type definitions for Prismic content, models, and APIs
https://prismic.io/docs/technologies/javascript
Apache License 2.0
11 stars 4 forks source link

fix: simplify `ImageField` #46

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR simplifies ImageField by changing how it uses handles ThumbnailNames when given null as its value.

Deprecating null in ThumbnailNames

As of this PR, ImageField<never> is the preferred method to type an Image field without thumbnails. ImageField<null> will continue to work, but null is now depreacted.

Reason for the change

@prismicio/helpers's use of ImageField in its isFilled.image() helper resulted in a broken index.d.ts file in @prismicio/helpers. The compiled type declaration file, bundled by rollup-plugin-dts, included invalid types.

See the following issues for more details:

The simplification made in this PR removes the invalid generated code in @prismicio/helpers and @prismicio/client.

Checklist:

🐻‍❄️

codecov-commenter commented 2 years ago

Codecov Report

Merging #46 (930a668) into master (5b4d5e5) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master       #46   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines         1768      1766    -2     
  Branches         7         7           
=========================================
- Hits          1768      1766    -2     
Impacted Files Coverage Δ
src/fields.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.