-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Ignore __proto__ #13933
Comments
This is extremely annoying. Consider this export const stepComponent = {
bindings: {
hasNextStep: '>',
hasPreviousStep: '>',
onNextStep: '&',
onPreviousStep: '&'
},
controller: class StepController {
public hasNextStep: boolean;
public hasPreviousStep: boolean;
public onNextStep: Function;
public onPreviousStep: Function;
}
};
angular.component('credentialsStep', {
__proto__: stepComponent,
bindings: {
__proto__: stepComponent.bindings,
user: '>'
},
controller: class CredentialsStepController extends stepComponent.controller {
public credentialsForm: angular.IFormController;
public user: any;
public repeatedPassword: string;
}
}); The credentialsComponent should be valid and have all properties of the stepComponent, instead it fails with
|
Also ran into this tonight while making custom error subclasses for Node. Was expecting TypeScript to ignore anything relating to class CustomError extends Error {
constructor (message?: string) {
// 'Error' breaks prototype chain here
super(message);
// restore prototype chain
const actualProto = new.target.prototype;
if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); } else { this.__proto__ = actualProto; }
}
} Credits: |
Same here. I just ran into this using the following loop structure:
It is a simple array of objects. The job of the loop is to iterate over all the objects and trim two of it's string properties. The documentation for typescript talks about iterating over the indexes of the array. The problem is after it's done doing that, the value of i changes from an index to 'contains' which is method on
This is completely broke our application when we upgraded typescript to 2.9.2. It worked great on 1.8. |
Just as a note, a full solution for this is described in this RFC: #38385. |
TypeScript Version: 2.2.0
Code:
Expected behavior:
Ok
Actual behavior:
Type '{ __proto__: {}; }' cannot be converted to type '{ [key: string]: string; }'.
The text was updated successfully, but these errors were encountered: