Skip to content

Commit 1bdc3f1

Browse files
vladboisathePunderWoman
authored andcommitted
docs(docs-infra): changed default type to object (angular#58289)
By API returned type is object, not any, rephrase docs and TIP Fixes angular#58273 docs: change type from object to Object Change the typo from object to Object Co-authored-by: Matthieu Riegler <[email protected]> PR Close angular#58289
1 parent 893886d commit 1bdc3f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adev/src/content/guide/http/making-requests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ http.get<Config>('/api/config').subscribe(config => {
1818
});
1919
</docs-code>
2020

21-
Note the generic type argument which specifies that the data returned by the server will be of type `Config`. This argument is optional, and if you omit it then the returned data will have type `any`.
21+
Note the generic type argument which specifies that the data returned by the server will be of type `Config`. This argument is optional, and if you omit it then the returned data will have type `Object`.
2222

23-
Tip: If the data has an unknown shape, then a safer alternative to `any` is to use the `unknown` type as the response type.
23+
Tip: When dealing with data of uncertain structure and potential `undefined` or `null` values, consider using the `unknown` type instead of `Object` as the response type.
2424

2525
CRITICAL: The generic type of request methods is a type **assertion** about the data returned by the server. `HttpClient` does not verify that the actual return data matches this type.
2626

0 commit comments

Comments
 (0)