Skip to content

Commit

Permalink
[TS1.7] more this-typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ztsai committed Dec 2, 2015
1 parent 21a1fcb commit 410f705
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
44 changes: 22 additions & 22 deletions plottable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ declare module Plottable.Axes {
* @param {boolean} The new text width approximation setting.
* @returns {Axes.Numeric} The calling Axes.Numeric.
*/
usesTextWidthApproximation(enable: boolean): Axes.Numeric;
usesTextWidthApproximation(enable: boolean): this;
private _hideEndTickLabels();
private _hideOverflowingTickLabels();
private _hideOverlappingTickLabels();
Expand Down Expand Up @@ -2799,7 +2799,7 @@ declare module Plottable {
* @param {number|string|Accessor<number>|Accessor<string>} attrValue
* @returns {Plot} The calling Plot.
*/
attr(attr: string, attrValue: number | string | Accessor<number> | Accessor<string>): Plot;
attr(attr: string, attrValue: number | string | Accessor<number> | Accessor<string>): this;
/**
* Sets a particular attribute to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the attribute values when autoDomain()-ing.
Expand All @@ -2809,7 +2809,7 @@ declare module Plottable {
* @param {Scale<A, number | string>} scale The Scale used to scale the attrValue.
* @returns {Plot} The calling Plot.
*/
attr<A>(attr: string, attrValue: A | Accessor<A>, scale: Scale<A, number | string>): Plot;
attr<A>(attr: string, attrValue: A | Accessor<A>, scale: Scale<A, number | string>): this;
protected _bindProperty(property: string, value: any, scale: Scale<any, any>): void;
private _bindAttr(attr, value, scale);
protected _generateAttrToProjector(): AttributeToProjector;
Expand All @@ -2821,7 +2821,7 @@ declare module Plottable {
/**
* Enables or disables animation.
*/
animated(willAnimate: boolean): Plot;
animated(willAnimate: boolean): this;
detach(): this;
/**
* @returns {Scale[]} A unique array of all scales currently used by the Plot.
Expand Down Expand Up @@ -2952,7 +2952,7 @@ declare module Plottable.Plots {
* @param {number|Accessor<number>} sectorValue
* @returns {Pie} The calling Pie Plot.
*/
sectorValue(sectorValue: number | Accessor<number>): Plots.Pie;
sectorValue(sectorValue: number | Accessor<number>): this;
/**
* Sets the sector value to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -2961,7 +2961,7 @@ declare module Plottable.Plots {
* @param {Scale<S, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
sectorValue<S>(sectorValue: S | Accessor<S>, scale: Scale<S, number>): Plots.Pie;
sectorValue<S>(sectorValue: S | Accessor<S>, scale: Scale<S, number>): this;
/**
* Gets the AccessorScaleBinding for the inner radius.
*/
Expand All @@ -2972,7 +2972,7 @@ declare module Plottable.Plots {
* @param {number|Accessor<number>} innerRadius
* @returns {Pie} The calling Pie Plot.
*/
innerRadius(innerRadius: number | Accessor<number>): Plots.Pie;
innerRadius(innerRadius: number | Accessor<number>): any;
/**
* Sets the inner radius to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -2981,7 +2981,7 @@ declare module Plottable.Plots {
* @param {Scale<R, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
innerRadius<R>(innerRadius: R | Accessor<R>, scale: Scale<R, number>): Plots.Pie;
innerRadius<R>(innerRadius: R | Accessor<R>, scale: Scale<R, number>): any;
/**
* Gets the AccessorScaleBinding for the outer radius.
*/
Expand All @@ -2992,7 +2992,7 @@ declare module Plottable.Plots {
* @param {number|Accessor<number>} outerRadius
* @returns {Pie} The calling Pie Plot.
*/
outerRadius(outerRadius: number | Accessor<number>): Plots.Pie;
outerRadius(outerRadius: number | Accessor<number>): this;
/**
* Sets the outer radius to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -3001,7 +3001,7 @@ declare module Plottable.Plots {
* @param {Scale<R, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
outerRadius<R>(outerRadius: R | Accessor<R>, scale: Scale<R, number>): Plots.Pie;
outerRadius<R>(outerRadius: R | Accessor<R>, scale: Scale<R, number>): this;
/**
* Get whether slice labels are enabled.
*
Expand Down Expand Up @@ -3327,7 +3327,7 @@ declare module Plottable.Plots {
* @param {number|Accessor<number>} size
* @returns {Plots.Scatter} The calling Scatter Plot.
*/
size(size: number | Accessor<number>): Plots.Scatter<X, Y>;
size(size: number | Accessor<number>): this;
/**
* Sets the size property to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -3336,7 +3336,7 @@ declare module Plottable.Plots {
* @param {Scale<S, number>} scale
* @returns {Plots.Scatter} The calling Scatter Plot.
*/
size<S>(size: S | Accessor<S>, scale: Scale<S, number>): Plots.Scatter<X, Y>;
size<S>(size: S | Accessor<S>, scale: Scale<S, number>): this;
/**
* Gets the AccessorScaleBinding for the symbol property of the plot.
* The symbol property corresponds to how the symbol will be drawn.
Expand All @@ -3348,7 +3348,7 @@ declare module Plottable.Plots {
* @param {Accessor<SymbolFactory>} symbol
* @returns {Plots.Scatter} The calling Scatter Plot.
*/
symbol(symbol: Accessor<SymbolFactory>): Plots.Scatter<X, Y>;
symbol(symbol: Accessor<SymbolFactory>): this;
protected _generateDrawSteps(): Drawers.DrawStep[];
/**
* @deprecated As of release v1.1.0, replaced by _entityVisibleOnPlot()
Expand Down Expand Up @@ -3565,7 +3565,7 @@ declare module Plottable.Plots {
* Smooth autoranging is done by making sure lines always exit on the left / right side of the plot
* and deactivating the nice domain feature on the scales
*/
autorangeSmooth(autorangeSmooth: boolean): Plots.Line<X>;
autorangeSmooth(autorangeSmooth: boolean): this;
private _setScaleSnapping();
/**
* Gets the interpolation function associated with the plot.
Expand All @@ -3579,7 +3579,7 @@ declare module Plottable.Plots {
* @param {string | points: Array<[number, number]>) => string} interpolator Interpolation function
* @return Plots.Line
*/
interpolator(interpolator: string | ((points: Array<[number, number]>) => string)): Plots.Line<X>;
interpolator(interpolator: string | ((points: Array<[number, number]>) => string)): this;
interpolator(interpolator: "linear"): this;
interpolator(interpolator: "linear-closed"): this;
interpolator(interpolator: "step"): this;
Expand All @@ -3604,7 +3604,7 @@ declare module Plottable.Plots {
*
* @returns {Plots.Line} The calling Plots.Line
*/
downsamplingEnabled(downsampling: boolean): Plots.Line<X>;
downsamplingEnabled(downsampling: boolean): this;
/**
* Gets if croppedRendering is enabled
*
Expand All @@ -3616,7 +3616,7 @@ declare module Plottable.Plots {
*
* @returns {Plots.Line} The calling Plots.Line
*/
croppedRenderingEnabled(croppedRendering: boolean): Plots.Line<X>;
croppedRenderingEnabled(croppedRendering: boolean): this;
protected _createDrawer(dataset: Dataset): Drawer;
protected _extentsForProperty(property: string): any[];
private _getEdgeIntersectionPoints();
Expand Down Expand Up @@ -3733,7 +3733,7 @@ declare module Plottable.Plots {
* For now, downsampling is always disabled in stacked area plot
* @returns {Plots.StackedArea} The calling Plots.StackedArea
*/
downsamplingEnabled(downsampling: boolean): Plots.Line<X>;
downsamplingEnabled(downsampling: boolean): this;
protected _additionalPaint(): void;
protected _updateYScale(): void;
protected _onDatasetUpdate(): this;
Expand Down Expand Up @@ -4642,7 +4642,7 @@ declare module Plottable.Interactions {
*
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
xScales(xScales: QuantitativeScale<any>[]): Interactions.PanZoom;
xScales(xScales: QuantitativeScale<any>[]): this;
/**
* Gets the y scales for this PanZoom Interaction.
*/
Expand All @@ -4652,7 +4652,7 @@ declare module Plottable.Interactions {
*
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
yScales(yScales: QuantitativeScale<any>[]): Interactions.PanZoom;
yScales(yScales: QuantitativeScale<any>[]): this;
/**
* Adds an x scale to this PanZoom Interaction
*
Expand Down Expand Up @@ -4701,7 +4701,7 @@ declare module Plottable.Interactions {
* @param {D} minDomainExtent The minimum domain extent for the scale.
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
minDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, minDomainExtent: D): Interactions.PanZoom;
minDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, minDomainExtent: D): this;
/**
* Gets the maximum domain extent for the scale, specifying the maximum allowable amount
* between the ends of the domain.
Expand All @@ -4722,7 +4722,7 @@ declare module Plottable.Interactions {
* @param {D} minDomainExtent The maximum domain extent for the scale.
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
maxDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, maxDomainExtent: D): Interactions.PanZoom;
maxDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, maxDomainExtent: D): this;
}
}
declare module Plottable {
Expand Down
2 changes: 1 addition & 1 deletion src/axes/numericAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ module Plottable.Axes {
* @param {boolean} The new text width approximation setting.
* @returns {Axes.Numeric} The calling Axes.Numeric.
*/
public usesTextWidthApproximation(enable: boolean): Axes.Numeric;
public usesTextWidthApproximation(enable: boolean): this;
public usesTextWidthApproximation(enable?: boolean): any {
if (enable == null) {
return this._usesTextWidthApproximation;
Expand Down
8 changes: 4 additions & 4 deletions src/interactions/panZoomInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ module Plottable.Interactions {
*
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
public xScales(xScales: QuantitativeScale<any>[]): Interactions.PanZoom;
public xScales(xScales: QuantitativeScale<any>[]): this;
public xScales(xScales?: QuantitativeScale<any>[]): any {
if (xScales == null) {
let scales: QuantitativeScale<any>[] = [];
Expand All @@ -283,7 +283,7 @@ module Plottable.Interactions {
*
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
public yScales(yScales: QuantitativeScale<any>[]): Interactions.PanZoom;
public yScales(yScales: QuantitativeScale<any>[]): this;
public yScales(yScales?: QuantitativeScale<any>[]): any {
if (yScales == null) {
let scales: QuantitativeScale<any>[] = [];
Expand Down Expand Up @@ -367,7 +367,7 @@ module Plottable.Interactions {
* @param {D} minDomainExtent The minimum domain extent for the scale.
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
public minDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, minDomainExtent: D): Interactions.PanZoom;
public minDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, minDomainExtent: D): this;
public minDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, minDomainExtent?: D): any {
if (minDomainExtent == null) {
return this._minDomainExtents.get(quantitativeScale);
Expand Down Expand Up @@ -406,7 +406,7 @@ module Plottable.Interactions {
* @param {D} minDomainExtent The maximum domain extent for the scale.
* @returns {Interactions.PanZoom} The calling PanZoom Interaction.
*/
public maxDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, maxDomainExtent: D): Interactions.PanZoom;
public maxDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, maxDomainExtent: D): this;
public maxDomainExtent<D>(quantitativeScale: QuantitativeScale<D>, maxDomainExtent?: D): any {
if (maxDomainExtent == null) {
return this._maxDomainExtents.get(quantitativeScale);
Expand Down
8 changes: 4 additions & 4 deletions src/plots/linePlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module Plottable.Plots {
* Smooth autoranging is done by making sure lines always exit on the left / right side of the plot
* and deactivating the nice domain feature on the scales
*/
public autorangeSmooth(autorangeSmooth: boolean): Plots.Line<X>;
public autorangeSmooth(autorangeSmooth: boolean): this;
public autorangeSmooth(autorangeSmooth?: boolean): any {
if (autorangeSmooth == null) {
return this._autorangeSmooth;
Expand Down Expand Up @@ -115,7 +115,7 @@ module Plottable.Plots {
* @param {string | points: Array<[number, number]>) => string} interpolator Interpolation function
* @return Plots.Line
*/
public interpolator(interpolator: string | ((points: Array<[number, number]>) => string)): Plots.Line<X>;
public interpolator(interpolator: string | ((points: Array<[number, number]>) => string)): this;
public interpolator(interpolator: "linear"): this;
public interpolator(interpolator: "linear-closed"): this;
public interpolator(interpolator: "step"): this;
Expand Down Expand Up @@ -148,7 +148,7 @@ module Plottable.Plots {
*
* @returns {Plots.Line} The calling Plots.Line
*/
public downsamplingEnabled(downsampling: boolean): Plots.Line<X>;
public downsamplingEnabled(downsampling: boolean): this;
public downsamplingEnabled(downsampling?: boolean): any {
if (downsampling == null) {
return this._downsamplingEnabled;
Expand All @@ -168,7 +168,7 @@ module Plottable.Plots {
*
* @returns {Plots.Line} The calling Plots.Line
*/
public croppedRenderingEnabled(croppedRendering: boolean): Plots.Line<X>;
public croppedRenderingEnabled(croppedRendering: boolean): this;
public croppedRenderingEnabled(croppedRendering?: boolean): any {
if (croppedRendering == null) {
return this._croppedRenderingEnabled;
Expand Down
12 changes: 6 additions & 6 deletions src/plots/piePlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module Plottable.Plots {
* @param {number|Accessor<number>} sectorValue
* @returns {Pie} The calling Pie Plot.
*/
public sectorValue(sectorValue: number | Accessor<number>): Plots.Pie;
public sectorValue(sectorValue: number | Accessor<number>): this;
/**
* Sets the sector value to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -129,7 +129,7 @@ module Plottable.Plots {
* @param {Scale<S, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
public sectorValue<S>(sectorValue: S | Accessor<S>, scale: Scale<S, number>): Plots.Pie;
public sectorValue<S>(sectorValue: S | Accessor<S>, scale: Scale<S, number>): this;
public sectorValue<S>(sectorValue?: number | Accessor<number> | S | Accessor<S>, scale?: Scale<S, number>): any {
if (sectorValue == null) {
return this._propertyBindings.get(Pie._SECTOR_VALUE_KEY);
Expand All @@ -150,7 +150,7 @@ module Plottable.Plots {
* @param {number|Accessor<number>} innerRadius
* @returns {Pie} The calling Pie Plot.
*/
public innerRadius(innerRadius: number | Accessor<number>): Plots.Pie;
public innerRadius(innerRadius: number | Accessor<number>): any;
/**
* Sets the inner radius to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -159,7 +159,7 @@ module Plottable.Plots {
* @param {Scale<R, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
public innerRadius<R>(innerRadius: R | Accessor<R>, scale: Scale<R, number>): Plots.Pie;
public innerRadius<R>(innerRadius: R | Accessor<R>, scale: Scale<R, number>): any;
public innerRadius<R>(innerRadius?: number | Accessor<number> | R | Accessor<R>, scale?: Scale<R, number>): any {
if (innerRadius == null) {
return this._propertyBindings.get(Pie._INNER_RADIUS_KEY);
Expand All @@ -179,7 +179,7 @@ module Plottable.Plots {
* @param {number|Accessor<number>} outerRadius
* @returns {Pie} The calling Pie Plot.
*/
public outerRadius(outerRadius: number | Accessor<number>): Plots.Pie;
public outerRadius(outerRadius: number | Accessor<number>): this;
/**
* Sets the outer radius to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the values when autoDomain()-ing.
Expand All @@ -188,7 +188,7 @@ module Plottable.Plots {
* @param {Scale<R, number>} scale
* @returns {Pie} The calling Pie Plot.
*/
public outerRadius<R>(outerRadius: R | Accessor<R>, scale: Scale<R, number>): Plots.Pie;
public outerRadius<R>(outerRadius: R | Accessor<R>, scale: Scale<R, number>): this;
public outerRadius<R>(outerRadius?: number | Accessor<number> | R | Accessor<R>, scale?: Scale<R, number>): any {
if (outerRadius == null) {
return this._propertyBindings.get(Pie._OUTER_RADIUS_KEY);
Expand Down
6 changes: 3 additions & 3 deletions src/plots/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Plot extends Component {
* @param {number|string|Accessor<number>|Accessor<string>} attrValue
* @returns {Plot} The calling Plot.
*/
public attr(attr: string, attrValue: number | string | Accessor<number> | Accessor<string>): Plot;
public attr(attr: string, attrValue: number | string | Accessor<number> | Accessor<string>): this;
/**
* Sets a particular attribute to a scaled constant value or scaled result of an Accessor.
* The provided Scale will account for the attribute values when autoDomain()-ing.
Expand All @@ -140,7 +140,7 @@ export class Plot extends Component {
* @param {Scale<A, number | string>} scale The Scale used to scale the attrValue.
* @returns {Plot} The calling Plot.
*/
public attr<A>(attr: string, attrValue: A | Accessor<A>, scale: Scale<A, number | string>): Plot;
public attr<A>(attr: string, attrValue: A | Accessor<A>, scale: Scale<A, number | string>): this;
public attr<A>(attr: string, attrValue?: number | string | Accessor<number> | Accessor<string> | A | Accessor<A>,
scale?: Scale<A, number | string>): any {
if (attrValue == null) {
Expand Down Expand Up @@ -214,7 +214,7 @@ export class Plot extends Component {
/**
* Enables or disables animation.
*/
public animated(willAnimate: boolean): Plot;
public animated(willAnimate: boolean): this;
public animated(willAnimate?: boolean): any {
if (willAnimate == null) {
return this._animate;
Expand Down
Loading

0 comments on commit 410f705

Please sign in to comment.