Skip to content

Add Recase typings - #15744

Merged
5 commits merged into
DefinitelyTyped:masterfrom
18steps:master
May 1, 2017
Merged

5 commits merged into
DefinitelyTyped:masterfrom
18steps:master

Conversation

@18steps

@18steps 18steps commented Apr 9, 2017

Copy link
Copy Markdown
Contributor

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not provide its own types, and you can not add them.
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • tslint.json should be present, and tsconfig.json should have noImplicitAny, noImplicitThis, and strictNullChecks set to true.

@dt-bot

dt-bot commented Apr 9, 2017

Copy link
Copy Markdown
Member

types/recase/index.d.ts

Checklist

Comment thread types/relaxed-json/index.d.ts Outdated
}): {};
export function stringify(obj: any): string;

export default {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This object is not the default export of the package!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, this line should simply be removed. The package doesn't have a default export, it has several named exports.

@@ -0,0 +1,36 @@
import RJSON from 'relaxed-json';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not how you would use the package in practice.

@RyanCavanaugh RyanCavanaugh added Revision needed This PR needs code changes before it can be merged. Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. and removed Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. labels Apr 17, 2017
Comment thread types/recase/index.d.ts Outdated
@@ -0,0 +1,7 @@
// Type definitions for Recase v1.0.4
// Project: https://www.npmjs.com/package/recase
// Definitions by: Mikal Madsen <[email protected]>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Prefer your github page like you used for relaxed-json

relaxed?: boolean,
warnings?: boolean,
tolerant?: boolean,
duplicate?: boolean,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One of the options may be a reviver function too. Also, tolerant doesn't appear in the documentation.

Comment thread types/relaxed-json/index.d.ts Outdated
}): {};
export function stringify(obj: any): string;

export default {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, this line should simply be removed. The package doesn't have a default export, it has several named exports.

Comment thread types/relaxed-json/tslint.json Outdated
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Change these to "extends": "dtslint/dt.json".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Failed to load ...\DefinitelyTyped\types\relaxed-json\tslint.json: Invalid "extends" configuration value - could not require "dtslint/dt.json". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.

The original value is what's generated by the generator script.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The generator script is out of date (microsoft/dts-gen#50), and you may be running an older version of dtslint if you're getting the above error.

@18steps

18steps commented Apr 22, 2017

Copy link
Copy Markdown
Contributor Author

For relaxed-json I'm exporting a Reviver type, but this is based on native JSON.parse so I'm wondering if there's a native type I should import, and if so where I can find it.

@ghost

ghost commented Apr 23, 2017

Copy link
Copy Markdown

The builtin JSON.parse just uses reviver?: (key: any, value: any) => any. (You can use goto-definition to see TypeScript's builtin type declarations.) I think yours is better though, see microsoft/TypeScript#6955.

@ghost
ghost merged commit ea34567 into DefinitelyTyped:master May 1, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Revision needed This PR needs code changes before it can be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants