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(gatsby-plugin-utils): Export two IRemoteFile utility types #37532

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Jan 25, 2023

Description

When one wants to create nodes (either for Image CDN file or image) and use TypeScript to assert the shape of the NodeInput object, one was at a loss since no types for that were exported.

With this PR you then can use it like this:

import type { IRemoteImageNodeInput } from "gatsby-plugin-utils"

const assetNode: IRemoteImageNodeInput = {
  id,
  url: data.url,
  mimeType: `image/jpg`,
  filename: data.url,
  width: data.width,
  height: data.height,
  placeholderUrl: `${data.url}?w=%width%&h=%height%`,
  alt: data.alt,
  parent: null,
  children: [],
  internal: {
    type: NODE_TYPES.Asset,
    contentDigest: gatsbyApi.createContentDigest(data),
  },
}
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 25, 2023
@LekoArts LekoArts added topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jan 25, 2023
@LekoArts LekoArts changed the title fix(gatsby-plugin-utils): Export two IRemoteFile utility types Jan 25, 2023
@marvinjude marvinjude merged commit d5a10f8 into master Jan 26, 2023
@marvinjude marvinjude deleted the remote-file-types branch January 26, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: TypeScript Issues and PRs related to TS in general, public typings or gatsby-plugin-typescript
2 participants