-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add TypeScript definition #13
Conversation
Hey. Awesome to see participation for Hacktoberfest. ✨ Can you follow this styleguide? |
I appreciate the offer, but I'm not interested in that. |
No problems :) |
@sindresorhus what awesome guideline for contributions, I did not know these standards of yours and the first time I see something like that. I learned a lot. |
|
index.d.ts
Outdated
export interface ShellEnv { | ||
readonly [x: string]: string; | ||
readonly SHELL: string; | ||
readonly TERM_PROGRAM: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are no guaranteed to exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
package.json
Outdated
"xo": { | ||
"ignores": [ | ||
"*.ts" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
index.test-d.ts
Outdated
import {expectType} from 'tsd-check'; | ||
import shellEnv, { sync, ShellEnv } from '.'; | ||
|
||
(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tsd-check supports top-level await. - https://github.com/sindresorhus/typescript-definition-style-guide
index.d.ts
Outdated
* @param shell To read the environment variables from. | ||
* @returns The environment variables. | ||
*/ | ||
export function shellEnv(shell?: string): Promise<ShellEnv>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a default export only, not a named export too.
index.d.ts
Outdated
/** | ||
* Get the environment variables defined in your dotfiles. | ||
* | ||
* @param shell To read the environment variables from. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document the default value.
Co-Authored-By: Fazendaaa <lucas.carotta@outlook.com>
Co-Authored-By: Fazendaaa <lucas.carotta@outlook.com>
Co-Authored-By: Fazendaaa <lucas.carotta@outlook.com>
Co-Authored-By: Fazendaaa <lucas.carotta@outlook.com>
Nice work! :) |
Hey, @sindresorhus.
Due to Hacktoberfest 2018, I'm contributing to some packages.
TypeScript typings help a lot of us who use it due to it's integration to TSLint and some more strict checkings, needed to be performed in some cases in the used packages as well; that's why I've decided to share the ones that I've made, making it more accessible to all programmers in this environment :)
Besides adding this, I would love to add a Husky integration to perform linter checkings, tests and documentation to git hooks. While doing this, if is it of your interest I can rewrite the JS parts in TS also, adding tests and everything.