-
Notifications
You must be signed in to change notification settings - Fork 6
Add source tests #7
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
Conversation
Make sure you gitignore |
We're talking about https://github.com/typed-typings/npm-chai/blob/master/lib/Assertion.d.ts#L5 right? You can make it an interface with both export interface AssertionStatic {
(target?: any, message?: string, stack?: Function): Assertion;
new (target?: any, message?: string, stack?: Function): Assertion;
} Something else you can do that might be worth doing, is making these types into value representations too. But it's a big refactor to do globally and more an FWIW right now. export var Assertion: {
(target?: any, message?: string, stack?: Function): Assertion;
new (target?: any, message?: string, stack?: Function): Assertion;
} However, then you need to use |
I was considering to make it into As for value representation, what is the pros for that? Is it because it shouldn't be a |
ES6 classes are prototypal inheritance, it's just sugar and you can probably read about online somewhere. It can definitely be a class, no advantage of the |
On the |
Yes, I know. What I am considering is whether to write the typing more accurately (staying close to the source, not using
Yeah, that's the pain point. And it make even less sense in typings. a mixin construct would be the best.
Currently I don't see a viable option for this yet. e.g. currently I'm manually adding Other packages would have their own test harness implementation.
Do you mean making changes directly under If we can tap into salsa and configure it to ignore certain rules (e.g. |
You could disable
No, just making it a copy/paste reproducible script. Something that can pull from the source and make changes in an automated fashion (like applying a patch on top). |
Anyway, it's a really cool experiment 👍 Nice to see where this can go! |
Just discover this: interface Model {
name: string;
[others: string]: any;
}
function createModel(x: Model) { ... }
// OK
createModel({name: 'hello', length: 100}); Really need to put this in some docs! |
interface DataModelOptions {
name?: string;
id?: number;
}
interface UserProperties {
[key: string]: any;
}
function createDataModel(model: DataModelOptions & UserProperties) {
/* ... */
}
// findDataModel can only look up by name or id
function findDataModel(model: DataModelOptions) {
/* ... */
}
// OK
createDataModel({name: 'my model', favoriteAnimal: 'cat' });
// Error, 'ID' is not correct (should be 'id')
findDataModel({ ID: 32 }); Also didn't know |
Yes, |
Overall experience is very good.
Easy to do, catch bunch of errors.
@blakeembrey there is an issue I don't know how to fix. Currently it fails the tests:
It's the
chai.Assertion
. It probably should be defined as a class, but I don't know how to convert it.Can you help me on that?