-
Notifications
You must be signed in to change notification settings - Fork 88
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
Questions for fixing up TypeScript tests #108
Comments
I will look into this as soon as I get my computer back |
Hey @wardbell, any update on the situation? |
(1) Yes the
These days I think you could write this as
That wasn't an option when this If we were providing comments (as I think we should) the two-line overload form is actually the better choice:
I guess I should note that the
It should be:
I don't know how many of these we have or who has time to fix them all. If/when we re-write Breeze in TS, we'll be able to get these right and maintain them. (2) The The This is a general pattern for validators in which the property value of the validator's "context" object parameter is interpolated into the generated message when the property key matches a token in the message template. The actual message template used will be the default defined for that validator UNLESS the optional TS cannot validate all of the possible property keys that might match a token in a message template ... because that is unknowable. The developer could change the effective message template at run-time as in this nonsense example:
What we know from reading the source code is that Breeze will interpolate the context property's value if it's in the message template and will ignore that value if the property key is not found as a token in the message template. In the example above with custom template, The
There is a mistake here in that the "context" parameter's two properties should be separated by a comma, not a semicolon which is illegal .Apparently this mistake is harmless (which surprises me). Or maybe the error drew your attention. Looking past this, what could the author have done? The minimal acceptable definition is
We have to state that Breeze looks for the
I might argue that we should also include the tokens in the default message template.
That would give even better intellisense. But, as I said, from a typechecking perspective, only the HTH. |
It sounds like these validators will need an appropriate index signature to type TemplateProperties = { [prop: string]: any; };
class Validator {
static maxLength(context: { maxLength: number, messageTemplate?: string } & TemplateProperties): Validator;
} |
Is that the new v.1.6 strict object literal checking stuff in action? I really like the v.1.6 changes, including the intersection operator, But what will these changes do to someone who has not upgraded to v.1.6 yet? Would the v.1.5 compiler/intellisense be stumped by the new stuff like the intersection operator? And the questions keep coming ;-) Does your definition of
Or, if I'm going to use
|
Correct; if you don't want to use the intersection operator, you can easily just add the index signature to each type literal like you did above (or create a And yes, you could move |
Hi there, I'm making some changes to correct the typings for Breeze on DefinitelyTyped/your repo as part of microsoft/TypeScript#4081.
I've run into two issues that I want to make sure I'm correcting...correctly 😄
In TypeScript 1.6, we give an error stating that
metadataStore
isn't an expected property inEntityTypeOptions
. I looked into the documentation, and indeed it seems that it takes eitherEntityTypeOptions
or aMetadataStore
type. Can you confirm that this is correct?Is
displayName an expected property here? Is it a name that's dynamically used at runtime? Or did the user mean
messageTemplate`?Sorry to ask these (probably simple) questions - I'm not entirely familiar with the project, but I'd like to help the best I can.
The text was updated successfully, but these errors were encountered: