Incomplete type definition for translatePathFromContext
See original GitHub issuetranslatePathFromContext
says it returns a Promise<DrupalTranslatedPath>
If you look at the code for that method, it returns:
return await this.translatePath(path, {
withAuth: this.getAuthFromContextAndOptions(context, options),
})
translatePath
says it also returns a Promise<DrupalTranslatedPath>
, but in fact can also return null:
if (!response?.ok) {
// Do not throw errors here.
// Otherwise next.js will catch error and throw a 500.
// We want a 404.
return null
}
In our app code, with no-unnecessary-condition
enabled, this causes a problem:
Typescript rightly doesn’t think path can be null, because it’s being told translatePathFromContext
will always resolve to a DrupalTranslatedPath
.
I imagine there are other signatures like this that are also not complete enough, any thoughts?
Issue Analytics
- State:
- Created 10 months ago
- Comments:5
Top Results From Across the Web
Issues · chapter-three/next-drupal - GitHub
Incomplete type definition for translatePathFromContext area: next-drupal bug Something isn't working. #359 opened on Nov 16 by martdavidson.
Read more >If struct type is defined in another .c file, it becomes incomplete ...
A translation unit, i.e. one .c file and its #include d .h files must be self-standing, containing in required order all the definitions...
Read more >translatePathFromContext - Next.js for Drupal
Fetch info about a Drupal path from getStaticProps or getServerSideProps context. ... withAuth: boolean | DrupalClientAuth : Set the authentication method to use....
Read more >Issue with "incomplete type" with CRTP : r/cpp_questions
CRTP uses the class it's defining as a template for a base class; thus it's not fully ... gives the error that T...
Read more >error: variable 'fops' has initializer but incomplete type
as shown in the error file. so how to solve that error. Source code: #define MODULE #include<linux/kernel.h>
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hmmm this does look like a bug. Let me look into it.
I wonder if I missed this because I have strict mode turned off.
Not a blocker, and also heading into vacation so no worries! Happy holidays!