Skip to content

HttpClient in 20.1 throws TS2769 when using documented 'timeout' option #62581

Closed

Description

@michael-small

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes

Description

(Credit to @IgorSedov who found this and wrote 95% of this but had to get going)

In Angular 20.1, a new timeout option was introduced for HttpClient requests, as documented in the official guide and 20.1 release notes. However, using this option currently results in a TypeScript error:

ERROR TS2769: No overload matches this call.
The last overload gave the following error.
Object literal may only specify known properties, and 'timeout' does not exist in type '{ headers?: HttpHeaders | Record<string, string | string[]> | undefined; context?: HttpContext | undefined; observe?: "body" | undefined; params?: HttpParams | ... 1 more ... | undefined; ... 9 more ...; transferCache?: boolean | ... 1 more ... | undefined; }'. [plugin angular-compiler]

TypeScript type definitions have not been updated to reflect it.

Code Example (from the documentation):

http.get('/api/config', {
  timeout: 3000,
}).subscribe({
  next: config => {
    console.log('Config fetched successfully:', config);
  },
  error: err => {
    // If the request times out, an error will have been emitted.
  }
});

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-tyswe3aa?file=src%2Fmain.ts

Please provide the exception or error you saw

ERROR TS2769: No overload matches this call.
The last overload gave the following error.
Object literal may only specify known properties, and 'timeout' does not exist in type '{ headers?: HttpHeaders | Record<string, string | string[]> | undefined; context?: HttpContext | undefined; observe?: "body" | undefined; params?: HttpParams | ... 1 more ... | undefined; ... 9 more ...; transferCache?: boolean | ... 1 more ... | undefined; }'. [plugin angular-compiler]

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.1.0
Node: 20.19.1
Package Manager: npm 10.8.2
OS: linux x64

Angular: 20.1.0
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.0
@angular-devkit/core         20.1.0
@angular-devkit/schematics   20.1.0
@schematics/angular          20.1.0
rxjs                         7.8.2
typescript                   5.8.2
zone.js                      0.15.0

Anything else?

No response

Activity

  1. wartab commented on Jul 11, 2025

    @wartab
    Contributor

    Looks like I missed adding it to the actual HttpClient class. I guess the tests somehow don't cover this. I am making a PR for this, however I'm noticing that other options are also sometimes missing in the signatures.

  2. added a commit that references this issue on Jul 11, 2025
    679822e
  3. added
    area: common
    on Jul 11, 2025
  4. added this to the needsTriage milestone on Jul 11, 2025
  5. added a commit that references this issue on Jul 14, 2025
    1408baf
  6. zip-fa commented on Jul 17, 2025

    @zip-fa

    Still an issue on 20.1.1

  7. JeanMeche commented on Jul 17, 2025

    @JeanMeche
    Member

    The fix only landed in 20.2.0, we probably should do a patch too.

  8. JeanMeche commented on Aug 6, 2025

    @JeanMeche
    Member

    We'll land this in 20.2 only. RC release next week, 20.2.0 will be shipped around August 20th.

  9. angular-automatic-lock-bot commented on Sep 6, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. locked and limited conversation to collaborators on Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: commonstate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions