Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use { [key: K]: V } instead or Record<K, V> for Maps #134

Closed
ramiroaisen opened this issue Dec 9, 2022 · 5 comments · Fixed by #277
Closed

Use { [key: K]: V } instead or Record<K, V> for Maps #134

ramiroaisen opened this issue Dec 9, 2022 · 5 comments · Fixed by #277

Comments

@ramiroaisen
Copy link

If we use

type T = Record<K, V>

and V is a type that circular reference type T we get an error in typescript.

This doesn't happen with

type T = { [key: K]: V }

If you are ok with this change I can make a PR, is a simple two liner change.

@carlocorradini
Copy link

Off topic: How about enabling also Map?

import type { B } from "./B";

export type A {
  map: Map<string, B>
}

@escritorio-gustavo
Copy link
Contributor

and V is a type that circular reference type T we get an error in typescript.

Hey @ramiroaisen! Can you give an example of this for testing?

@escritorio-gustavo
Copy link
Contributor

Off topic: How about enabling also Map?

I don't think support for Map will be implemented, but you can use #[type = "Map<K, V>"]

@escritorio-gustavo escritorio-gustavo changed the title Use { [key: K]: V } instead or Record<K, V> for Maps Use { [key: K]: V } instead or Record<K, V> for Maps Mar 5, 2024
@escritorio-gustavo
Copy link
Contributor

This issue seems to be stale, so I'll close it for now. If there is still interest in this feature, please open a new issue.

@escritorio-gustavo escritorio-gustavo closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@escritorio-gustavo
Copy link
Contributor

Due to #276, this has become a relevant issue for new features, so I'm reopening the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants