question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't create Record<Id, any>

See original GitHub issue

Expected Behavior

Since Id objects are just strings, I should be able to create a Record using Ids as keys.

Actual Behavior

I get the following error:

Type 'Id<Creep>' does not satisfy the constraint 'string | number | symbol'.
  Type 'Id<Creep>' is not assignable to type 'string'.

Sample code (if available)

var data: Record<Id<Creep>, number> = {};

Your Environment

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
edutercommented, Nov 12, 2019

I don’t know what’s the use case, but const data = new Map<Id<Creep>, number>() may also be an option.

0reactions
pyrodoggcommented, Nov 16, 2019

Cast to string or number as index types can only be string | number | symbol types.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LWC create record - getting 'undefined' for record.id in 'then'
Taking a look at Create a Record documentation, the field's values are returned in the fields attribute and that every field in that...
Read more >
You cannot create a field that references the Record ID field ...
I have a formula field that concatenates a few different fields into 1 value, one of which is the record ID.
Read more >
Flow: How To Use Record Id - Salesforce Flowsome!
During the Salesforce releases in 2020, there are more intuitive ways to achieve this by using “RecordId” variable. A variable: with any name,...
Read more >
Flow Builder Get Contact ID of record created during Flow ...
I want to get the ID of the Contact just created and reference it on a Lookup on the original Contact record. Any...
Read more >
can not create Record. Error: missing Employees record ID
Hi all,. I am new in Appgywer, I am learning follow the official tutorial. But I got stuck in Topic: Data → creating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found