PLATFORM_ID injection token has incorrect type

This issue has been created since 2022-11-18.

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

common

Is this a regression?

No

Description

Correct type should be "string" instead of "Object", because this token returns one of these string values:
https://github.com/angular/angular/blob/main/packages/common/src/platform_id.ts#L9-L12

Please provide a link to a minimal reproduction of the bug

https://angular.io/api/core/PLATFORM_ID

Please provide the exception or error you saw

No response

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

Angular CLI: 13.3.9
Node: 16.14.2
Package Manager: npm 8.5.0
OS: darwin x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1303.9 (cli-only)
@angular-devkit/core         13.3.9 (cli-only)
@angular-devkit/schematics   13.3.9 (cli-only)
@schematics/angular          13.3.9 (cli-only)

Anything else?

No response

JoostK wrote this answer on 2022-11-23
-1

The Object type is indicating that this is an opaque type, not necessarily a string. That it is a string at runtime is an implementation detail.

belyan wrote this answer on 2022-11-23

As for me, it is wrong to compare an Object with a string, as doing here:
https://github.com/angular/angular/blob/main/packages/common/src/platform_id.ts#L19

Also ESlint don't like when Object used as type when inject this token:

@Inject(PLATFORM_ID) private platformId: Object

These are the reasons why I changed the type to string in my Angular project:

@Inject(PLATFORM_ID) private platformId: string
belyan wrote this answer on 2022-11-23

Every time Angular Team close issues in this way, your framework loses a few points, and here is the result:
https://2021.stateofjs.com/en-US/libraries/front-end-frameworks/

Keep going guys :)

More Details About Repo
Owner Name angular
Repo Name angular
Full Name angular/angular
Language TypeScript
Created Date 2014-09-18
Updated Date 2022-12-01
Star Count 85220
Watcher Count 3042
Fork Count 22607
Issue Count 1316

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Download as latex has (non-critical) compile errors 1 2021-05-24 2022-10-12
Issue with togpx method when trying to convert geojson object to gpx 1 2021-12-19 2022-11-13
[K User Manual] - Adding command line options of using K 3 2022-03-21 2022-05-08
Streaming through HTTP.open() with a POST 2 2021-11-10 2022-09-26
Trigger helper and TiledMapMover not working 3 2020-07-04 2022-11-20
Dependency Dashboard 0 2021-08-25 2022-11-28
全局模式下多任务不同分辨率输出会全部变成第一个任务的输出分辨率 2 2022-03-19 2022-10-08
php closing tag is deleted 2 2021-10-03 2022-11-11
Is this project dead? 1 2021-01-18 2022-11-13
Define objectives and scope for website portage [content] 3 2021-11-03 2022-10-11
Symfony\Component\Debug\Exception\FatalErrorException in GET / 0 2022-09-15 2022-09-28
Exception in GET /get-helptopic-form 0 2022-09-20 2022-09-28
Exception in GET /ticket/print/2 0 2022-09-19 2022-09-28
UnexpectedValueException in GET /api/v3/sso_return 0 2022-09-19 2022-09-28
Bug Report - Other: Plugin Over-sorting and Explorer Crashes 1 2022-07-27 2022-10-09
qq ip 61.241.50.202 2 2022-10-10 2022-11-23
Feature request: A way to inspect the query string run by asyncpg 1 2022-05-16 2022-11-23
BulkInsert: InvalidOperationException when entity has more then one ownedType 1 2021-11-30 2022-11-12
Incorrect info.width on Windows terminals 1 2021-05-21 2022-11-20
Mordant 2.0 max table width 4 2021-04-12 2022-11-20
How to disable "Add to Homescreen". 1 2018-09-02 2022-11-28
Intermittent Tokenizer Test 0 2022-05-16 2022-11-10
Crash if I turn off my vpn 1 2021-10-09 2022-11-16
support object as reference 0 2020-07-06 2022-10-31
Allow OptunaSearchCV to accept callbacks 4 2022-04-27 2022-10-08
Problem with pad in transforms 0 2022-07-13 2022-10-19
Provide Mixin as an optional project configuration 3 2021-01-28 2022-11-08
Broken GoDoc in comment for Decimal.UnmarshalMsgpack 0 2022-08-04 2022-11-13
Running into issues when including y.js (npm package) in my workers logic 2 2022-01-18 2022-10-06
feature request: alias records in route53 0 2022-09-09 2022-09-21
10.8.0 alpha2 NFO (old version) read error And Media library sort BUG. 1 2021-11-17 2022-09-23
Removing access to Usage plan of a group does not revoke the existing API Keys 3 2021-12-14 2022-11-21
[Feature request] Recursive listing for local files 0 2019-05-25 2022-11-16
Add support for context variables / dependency injection (or context mechanism in general) 6 2022-09-21 2022-10-17
Add a `group_connect()` method to monitor signals from any nodes within a group 0 2022-09-21 2022-10-17
Fix requirements.txt / requirements-dev.txt 2 2021-06-09 2022-10-12
Use native window borders 2 2016-09-26 2022-10-23
Can I hide the greeting ? 1 2021-10-15 2022-10-31
Redactions does not work with btree keys 0 2021-08-25 2022-11-22
Document lemminx debug process with vscode-xml 1 2021-07-02 2022-10-08
Adding constraints to Multi-fidelity BO with discrete fidielities 3 2022-02-26 2022-11-26
Correct typo in docstring of Histogram 1 2021-08-28 2022-02-09
关键信息抽取(ser)训练模型或者推理模型支持转onnx吗 2 2022-11-28 2022-11-22
识别pdf文件时,引用的pymupdf的 property name变更导致报错 3 2022-11-28 2022-11-22
PaddleOCR kie模式训练模型支持转为onnx吗?如何移动端部署? 3 2022-11-28 2022-11-22
Fix email validation 0 2020-10-27 2022-10-22
String.prototype.replaceAll gets renamed 2 2021-06-02 2022-10-24
IP conflict between source and clone vm 1 2022-07-31 2022-11-02
Pie饼图点击图例,饼图resize时有bug🧐[问题] 1 2022-06-30 2022-10-31
Kibana Fleet setup failed: http POST request to .... fails: Unauthorized 13 2021-12-24 2022-11-09