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

Create TS definition type #76

Open
2 tasks done
Taranys opened this issue Aug 16, 2017 · 3 comments
Open
2 tasks done

Create TS definition type #76

Taranys opened this issue Aug 16, 2017 · 3 comments

Comments

@Taranys
Copy link

Taranys commented Aug 16, 2017

Prerequisites

Description

Add TS definition file to have type checking

Expected behavior

Using immutadot properly with typescript

@hgwood
Copy link
Contributor

hgwood commented Sep 2, 2017

Not very useful without this: microsoft/TypeScript#12290

@KiaraGrouwstra
Copy link

To comment on that, from what I can see this library appears to parse paths from strings such as 'nested.prop'. TypeScript currently lacks ways to operate on string literals, and afaik thus far this is so far deemed out of scope (microsoft/TypeScript#15645 (comment)).

I wouldn't mind seeing that reconsidered, as I feel this is a valid use-case for not only this library but also the likes of Lodash. Until that happens though, I fear the best thing TS might be able to handle is paths where the constituents are not mashed into one string.

@katywings
Copy link

Little idea for this: Now with ts in babel it would be possible to create a babel macro that just converts a object path to a string, basically:
turnTostringMacro(myObj.andSoOn) // transpiles througj babel-macro to "myObj.andSoOn". Just as an idea :)

Then for ts you would only need a function declaration which takes "any" and returns "string" ;)

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

No branches or pull requests

5 participants