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

Fixed typescript typing for sandbox #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joepjoosten
Copy link

I was using jsonpath plus in my typescript app, and noticed that the sandbox has the wrong typing. This will result in a compilation error in typescript, and makes using the sandbox setting impossible.

Could you release this asap? Otherwise using the sandbox settings with typescript is not possible.

@joepjoosten
Copy link
Author

#114
I also created an issue for this pull request

@brettz9
Copy link
Collaborator

brettz9 commented Jan 14, 2020

Ok, sure. But could you start us off with a sample TS file which adds a sandbox? We already have typescript as a devDep, so we should be able to add an npm script to test such a sample file (as we do against the declaration file itself), and I'd ultimately like to confirm all our type mappings against this sample file.

@joepjoosten
Copy link
Author

Yes, i'll add one.

@brettz9
Copy link
Collaborator

brettz9 commented Jan 14, 2020

FYI, I've made some tweaks to types at #115 . I can merge after your PR, but just letting you know, as I think those changes add some more specificity than just "any" (or greater clarity in the case where "JSON" or "any" can be returned (on JS objects)).

@joepjoosten
Copy link
Author

Tried to create a typescript test with this code:
https://gist.github.com/joepjoosten/9d59145b9d9337ec43ed47488cc035ef
It compiles, but i can't get it to run. It keeps failing to resolve jsonpath-plus.

@brettz9
Copy link
Collaborator

brettz9 commented Jan 15, 2020

Can you use a relative path instead?

@joepjoosten
Copy link
Author

Also tried that, but doesn't work...
Tried allot in a couple of hours. But nothing seems to work.
We could have a look together, if you have time?

@brettz9
Copy link
Collaborator

brettz9 commented Jan 15, 2020

I'm afraid I'm really falling behind on my other projects, and I have close to no experience in using TS.

@k-jay-c
Copy link

k-jay-c commented Jul 29, 2021

Hi,

I was having the same issue, for the time being, I've updated the jsonpath.d.ts and set the sandbox type to any. This will allow typescript to compile and also run.

Can I recommend this update be made in the interim for typescript.

sandbox?: any

Thanks.

@brettz9
Copy link
Collaborator

brettz9 commented Jul 29, 2021

I've added some further commits to #115 . Would you mind trying that out? I think that should solve the sandbox issue, but would be nice to check the greater specificity now that I think the sandbox issue has been worked out.

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 this pull request may close these issues.

3 participants