Skip to content

Add type definitions#32

Merged
wooorm merged 7 commits intoremarkjs:mainfrom
TaylorBeeston:add-type-definitions
Jul 23, 2020
Merged

Add type definitions#32
wooorm merged 7 commits intoremarkjs:mainfrom
TaylorBeeston:add-type-definitions

Conversation

@TaylorBeeston
Copy link
Copy Markdown
Contributor

Closes GH-28

This PR adds the types directory that contains an index.d.ts file that allows TypeScript projects to use this package more easily. Additionally, there are some tests to ensure the correctness of this type definition, and some boilerplate associated with dtslint. package.json has been updated to include dtslint and unified (this is required for the Plugin type) as explicit dependencies. There is also the addition of the test-types script to run dslint, and index.d.ts is exported as the types file for this project.

This is my first time writing a .d.ts file for a project, so please forgive me if there are any issues. One thing I would like to note is that the sanitize parameter is currently just accepting nearly any object. I feel that a more rigid type should be defined within hast-util-sanitize based upon the definition of schema in the readme. If needed, I can try and write a .d.ts file for that repo as well, however, I would like to try and solve one step at a time, and make sure that I am doing things correctly along the way.

@codecov-commenter

This comment has been minimized.

Copy link
Copy Markdown
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

Thanks @TaylorBeeston!

@ChristianMurphy ChristianMurphy added ☂️ area/types This affects typings 🦋 type/enhancement This is great to have 🧑 semver/major This is a change labels Jul 10, 2020
Comment thread types/index.d.ts Outdated
@ChristianMurphy ChristianMurphy added the 🌊 blocked/upstream This cannot progress before something external happens first label Jul 10, 2020
Copy link
Copy Markdown
Member

@BarryThePenguin BarryThePenguin left a comment

Choose a reason for hiding this comment

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

📈 looks good! 👍🏻

@ChristianMurphy ChristianMurphy linked an issue Jul 11, 2020 that may be closed by this pull request
@TaylorBeeston
Copy link
Copy Markdown
Contributor Author

I went ahead and added the correct type definitions for sanitize and handlers. I also added some tests to reflect the change.

This is the first time I've had a pull request open while the main branch merged in changes, so I'm not 100% certain I handled it correctly. I just git pulled main, then merged my local version of main into this branch (see commit 03206a3, "Merge branch 'main' into add-type-definitions"). I am hoping that was the right thing to do!

Copy link
Copy Markdown
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @TaylorBeeston! 🙇

Comment thread package.json Outdated
Co-authored-by: Christian Murphy <[email protected]>
@ChristianMurphy ChristianMurphy removed the 🌊 blocked/upstream This cannot progress before something external happens first label Jul 21, 2020
@ChristianMurphy ChristianMurphy requested a review from wooorm July 21, 2020 14:33
@wooorm wooorm merged commit 87d88f7 into remarkjs:main Jul 23, 2020
@wooorm
Copy link
Copy Markdown
Member

wooorm commented Jul 23, 2020

Thanks @TaylorBeeston, released!

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

Labels

☂️ area/types This affects typings 💪 phase/solved Post is done 🧑 semver/major This is a change 🦋 type/enhancement This is great to have

Development

Successfully merging this pull request may close these issues.

Add types

6 participants