microsoft / TypeScript-Handbook

Deprecated, please use the TypeScript-Website repo instead
https://github.com/microsoft/TypeScript-Website
Apache License 2.0
4.88k stars 1.13k forks source link

Fix code sample #1315

Closed crookedneighbor closed 4 years ago

crookedneighbor commented 4 years ago

Was reading through the documentation and came across the code examples here: https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#no-implicit-any-for-this

interface Point {
    distanceFromOrigin(point: Point): number;
}
Point.prototype.distanceFromOrigin = function(point: Point) {
    return this.getDistance({ x: 0, y: 0});
}
Point.prototype.distanceFromOrigin = function(this: Point) {
    return this.getDistance({ x: 0, y: 0});
}

Trying to make sense of what the point: Point is supposed to be doing. It looks like it's an argument for the function, but the function doesn't use it. I suspect it's a typo, but would love to know for sure.

This PR removes it, under the assumption that it is a typo.

crookedneighbor commented 4 years ago

👋 any update on this?

orta commented 4 years ago

This repo is basically deprecated now that all the handbook has moved into v2 - my plan was to try and manually merge all the changes into the new pages when https://github.com/microsoft/TypeScript-Handbook/pull/1313 is merged

crookedneighbor commented 4 years ago

@orta is there a separate place to PR? Happy to open a PR elsewhere if that's easier.

orta commented 4 years ago

Yep, the TypeScript website: https://github.com/microsoft/TypeScript-website

https://github.com/microsoft/TypeScript-Website/blob/v2/packages/handbook-v1/en/tutorials/Migrating%20from%20JavaScript.md

crookedneighbor commented 4 years ago

That's great, thanks for the link. Here's the new PR https://github.com/microsoft/TypeScript-Website/pull/540

I'll close this one.