-
Notifications
You must be signed in to change notification settings - Fork 16
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
Copied typings from DefinitelyTyped #11
Conversation
@@ -1,27 +1,29 @@ | |||
{ | |||
"name": "assertion-error" |
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.
It feels so good to have this file indented like this 😆
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.
Yeah this is what happens automatically. I can't stand pre-line commas anyway! D:
Thanks @JoshuaKGoldberg! This looks awesome! LGTM. Seems like we will have TypeDefinitions on our next release 😄 |
It's a good start. |
Here is a stricter modelization supporting the property types (I'm using an internal module declaration style because I was testing in my local project): declare module "assertion-error" {
type AssertionError<T> = Error & T & {showDiff: boolean};
interface AssertionErrorConstructor {
new<T>(message: string, props?: T, ssf?: Function): AssertionError<T>;
}
const AssertionError: AssertionErrorConstructor;
export = AssertionError;
} You can use it as: const assertionError: AssertionError<{foo: number}> = new AssertionError("msg", {foo: 42});
const msg: string = assertionError.message;
const foo: number = assertionError.foo; This brings more useful information about the assertion error (custom properties). Note: I used explicit types, but if you only use inference, it still properly detects that the instance has a property |
Adds TypeScript as a dev dependency and specifies `index.d.ts` as typings, with `--noEmit` tests run as part of `test`.
@demurgos added! I defaulted |
Thank you for taking time to update the typings. @keithamus, @lucasfcosta |
Could we move forward with this issue? |
Does someone want to raise a PR bumping the package.json so we can release? |
I'll do a PR. |
- Add type definitions (chaijs#11)
- Add type definitions (chaijs#11)
Adds TypeScript as a dev dependency and specifies
index.d.ts
as typings, with--noEmit
tests run as part oftest
.Fixes #10.