-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Tag and release v4.2.0? #50
Comments
Have you tried the beta release? (Under the next tag, IIRC) |
Right, I should try that first. |
I think the library itself generally works fine, but the type definitions from DT is giving me some headaches. Usually I can use TypeScript declaration merging to fill in the new API myself, but since this library is using default export, it is not possible at the moment (microsoft/TypeScript#14080). To workaround this I had to re-export Would it be possible to also provide (or change to) non-default export in this library? |
AFAIK non-default export would be a breaking change, so I'd rather not do that. I could add JSDoc style type annotations? |
Would it be possible to add a non-default export of the same |
Does this help 8467661? |
Unfortunately it doesn't seem to help. TypeScript doesn't pick up the type annotations when this package is installed as a dependency. I'm not sure if TypeScript compiler ignores |
Also, I believe that the return type definition for The current definition is: {
response: { headers: Record<string, string>} | undefined,
revalidation: { headers: Record<string, string>, synchronous: boolean } | undefined
} For example, if interface EvaluateRequestHitWithoutRevalidationResult {
response: {
headers: CachePolicy.Headers;
};
revalidation: undefined;
}
interface EvaluateRequestHitWithRevalidationResult {
response: {
headers: CachePolicy.Headers;
};
revalidation: EvaluateRequestRevalidation;
}
interface EvaluateRequestMissResult {
response: undefined;
revalidation: EvaluateRequestRevalidation;
}
type EvaluateRequestResult =
| EvaluateRequestHitWithRevalidationResult
| EvaluateRequestHitWithoutRevalidationResult
| EvaluateRequestMissResult;
interface CachePolicy {
evaluateRequest(req: HttpRequest): EvaluateRequestResult;
} However this is perhaps too cumbersome to express in one line in the JSDoc. |
I've added "types" to package.json, this should help finding them. |
Sorry, it still doesn't seem to help. Please see this example: https://gist.github.com/hexchain/1b266612ac7bc217dae48526e54d225a
|
I've opened a PR for DT: DefinitelyTyped/DefinitelyTyped#72265 |
Would it be possible to tag and release version 4.2.0? I'd really like to use the new
evaluateRequest
API in a project.The text was updated successfully, but these errors were encountered: