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

Provide a quick cast factory for users #19

Open
ProdigySim opened this issue Aug 5, 2020 · 1 comment
Open

Provide a quick cast factory for users #19

ProdigySim opened this issue Aug 5, 2020 · 1 comment

Comments

@ProdigySim
Copy link
Owner

We should create a PojoMap.of() or a PojoMap.from() for casting map-like objects to PojoMaps quickly and safely. Many types can already be implicitly cast to PojoMap, so we should give people a way to do that cast without manually type asserting (with all of the generics...)

function of<K extends PropertyKey, V extends {}>(maplike: PojoMap<K, V>): PojoMap<K,V> {
    return maplike;
}

Examples

@ProdigySim
Copy link
Owner Author

This wouldn't help for casting from Record<string, T> to PojoMap<TinyType, T>, unfortunately.

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

No branches or pull requests

1 participant