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.

Different Array<T> and Promise<T> types getting assigned the same metadata store id

See original GitHub issue

I ran into an issue with using getType on arrays and promises.

const x = getType<string[]>().getTypeArguments()[0]; // returns string
const y  = getType<number[]>().getTypeArguments()[0] // also returns string

I cloned the library and ran in debug mode inside the test suite:

image

I think the problem is that string[] and number[] are getting assigned the same metadata store id.

Let me know if I can help in any way, maybe this is already fixed in the update you are working on.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bjsicommented, Mar 7, 2022

Awesome, looks like the issue is fixed for me!

1reaction
Hookynscommented, Mar 7, 2022

Solved.

I’ve published tst-reflect-transformer@0.9.5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript - How to unwrap the type of a Promise?
Let's get the parameters of that function. Parameters<Promise<string>['then']>[0] the first parameter of then : its callback.
Read more >
Observables compared to other techniques - Angular
Promises provide one. This makes observables useful for getting multiple values over time. Observables differentiate between chaining and subscription.
Read more >
Meta programming - JavaScript - MDN Web Docs
Proxy objects allow you to intercept certain operations and to implement custom behaviors. For example, getting a property on an object: const ...
Read more >
Array - Sanity.io
When adding data with type: 'object' to an array, each item gets assigned a persistent and unique _key property. This is to ensure...
Read more >
How to Deep Copy Objects and Arrays in JavaScript
Shallow copy using .assign(). 3.The same type of shallow copy would be created using Object.assign() , which can be used with any object...
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