-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-filesystem] Incorrect type definition for createFileNodeForAsset #35363
Comments
Hi, thanks for the issue! Indeed, the TypeScript definition diverged from what is actually correct now. The TypeScript definitions are here: gatsby/packages/gatsby-source-filesystem/index.d.ts Lines 29 to 45 in b669468
A reference for what it actually should be is https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L105 and
|
Hi, can I work on this? If I understand right, I have to modify the index.d.ts to match the references, like adding the missing argument and setting the others to optional when required. |
I looked into it a bit yesterday, although I don't think I'm going to implement this change. It seems that the export interface CreateRemoteFileNodePayload {
url: string
cache?: GatsbyCache
getCache?: Function
createNode: Function
createNodeId: Function
parentNodeId?: string
auth?: {
htaccess_user: string
htaccess_pass: string
}
httpHeaders?: object // could also be `{ [key: string]: string }`?
ext?: string
name?: string
} |
The same thing as been bothering me but the function description here
has me confused as to whether the reporter param is required or not, should I remove this line as well? I'm removing the Store param as it's not mentioned in the refrences. Also I noticed, that createFileNodeFromBuffer has the same issue, should I change that as well? Here gatsby/packages/gatsby-source-filesystem/index.d.ts Lines 47 to 58 in b669468
when it should be like gatsby/packages/gatsby-source-filesystem/src/create-file-node-from-buffer.js Lines 118 to 129 in f63d13d
If someone would confirm this, I'll push the changes. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
This is still an issue, looks like the PR #35422 has got stuck |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
This comment was marked as off-topic.
This comment was marked as off-topic.
…5422) * fixes issue #35363 and CreateFileNodeFromBufferArgs * modified tests for remote-file-node and file-node-from-buffer * updated function calls in dependencies * removed unused typescript imports Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]>
…tsbyjs#35422) * fixes issue gatsbyjs#35363 and CreateFileNodeFromBufferArgs * modified tests for remote-file-node and file-node-from-buffer * updated function calls in dependencies * removed unused typescript imports Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]>
Preliminary Checks
Description
The type definition for
createRemoteFileNode
(specifically theCreateRemoteFileNodeArgs
interface) doesn't match the documentation or implementation, in particular:store
is mandatory in the types, but not present in the docs or implementationcache
is mandatory in the types, but not present in the docs, and optional in the implementationgetCache
is missing from the types, but mandatory in the docs, and optional in the implementation (but you must pass one ofcache
orgetCache
)reporter
is mandatory in the types, but not present in the docs or implementationSteps to Reproduce
gatsby-node.ts
createRemoteFileNode
function as documented:Expected Result
Typescript compiles successfully
Actual Result
Type errors being reported due to incorrect arguments
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: