Skip to content

Typescript defs #165

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

Closed
wants to merge 2 commits into from
Closed

Conversation

darcyparker
Copy link

Addresses #97

In my tests, these definitions appear to be correct. However, when reading the 'src/*.js' files, it appears there is a 'static parse' method that I do not see in the built distribution. Perhaps the comments were not correct... or I am misunderstanding them.

@darcyparker
Copy link
Author

darcyparker commented Mar 25, 2021

Can someone give feedback or figure out why the ci / sonarcloud (pull_request) is failing? When I look at the details, I am not sure what to make of it. Is it setup correctly? There is a message Set the SONAR_TOKEN env variable.

@darcyparker darcyparker mentioned this pull request Mar 25, 2021
@dmaccormack dmaccormack self-assigned this Mar 25, 2021
@dmaccormack dmaccormack added the enhancement New feature or request label Mar 25, 2021
}

declare class JsonURL {
//Source comments suggest this is deprecated:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was deprecated very recently. I left tests in place because the next release will be a semver minor increment. I'll likely remove it for 2.0

//* It is necessary to parse()
constructor(prop?: JsonURLParseOptions);

//Source comments suggests static parse() is available,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the static method was added with a recent commit but I haven't cut a release yet.

I've chosen to deprecate (and eventually remove) the constructor and added the static parse() method so that the library interface mirrors JSON. That is, with static parse() and stringify() methods.

emptyValue?: any; //default is {}
nullValue?: any; //default is null

//These feel like they are intended to be protected
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can verify the intention is for them to be public. They allow the caller to modify parse behavior. The comments on the parse() method should provide a brief summary and many of them are outlined in section 2.9 of the specification.

Thanks for these comments, BTW! Knowing where the docs fall short will help me know where to improve them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NP.

With this start on the typescript definitions, I think you have a good feel of how to define them. Feel free to rework them to represent the intended interfaces. I don't mind if you close this and replace it with another pull request. I would just like to have some typescript definitions in the near future that represent the public interfaces accurately.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darcyparker let me know if you see any concerns with #177

@dmaccormack
Copy link
Collaborator

Can someone give feedback or figure out why the ci / sonarcloud (pull_request) is failing? When I look at the details, I am not sure what to make of it. Is it setup correctly? There is a message Set the SONAR_TOKEN env variable.

Yeah, sonarcloud requires auth. It has a check for github.repository_owner == 'jsonurl' so I'm not sure why it ran. I'll have to dig into that.

@dmaccormack
Copy link
Collaborator

See #177.

@dmaccormack dmaccormack closed this Apr 8, 2021
@darcyparker darcyparker deleted the typescriptDefs branch April 8, 2021 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants