Skip to content

Commit 28b6eba

Browse files
Alexander VakrilovSvetoslavTsenov
Alexander Vakrilov
authored andcommitted
TypeScript 2.5 compatibility (NativeScript#4794)
1 parent a79a83c commit 28b6eba

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

tns-core-modules/ui/image/image-common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ImageSource, fromAsset, fromNativeSource, fromUrl } from "../../image-s
55
import { isDataURI, isFileOrResourcePath, RESOURCE_PREFIX } from "../../utils/utils";
66

77
export * from "../core/view";
8-
export { ImageSource, fromAsset, fromNativeSource, fromUrl, isDataURI, isFileOrResourcePath, RESOURCE_PREFIX };
8+
export { ImageSource, ImageAsset, fromAsset, fromNativeSource, fromUrl, isDataURI, isFileOrResourcePath, RESOURCE_PREFIX };
99

1010
export abstract class ImageBase extends View implements ImageDefinition {
1111
public imageSource: ImageSource;
@@ -24,7 +24,7 @@ export abstract class ImageBase extends View implements ImageDefinition {
2424
/**
2525
* @internal
2626
*/
27-
public _createImageSourceFromSrc(value: string | ImageSource): void {
27+
public _createImageSourceFromSrc(value: string | ImageSource | ImageAsset): void {
2828
const originalValue = value;
2929
const sync = this.loadMode === "sync";
3030
if (typeof value === "string" || value instanceof String) {

tns-core-modules/ui/image/image.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
ImageSource, ImageBase, stretchProperty, imageSourceProperty, srcProperty, tintColorProperty, Color,
2+
ImageSource, ImageAsset, ImageBase, stretchProperty, imageSourceProperty, srcProperty, tintColorProperty, Color,
33
isDataURI, isFileOrResourcePath, RESOURCE_PREFIX
44
} from "./image-common";
55
import { knownFolders } from "../../file-system";
@@ -75,7 +75,7 @@ export class Image extends ImageBase {
7575
this.nativeViewProtected.setImageMatrix(new android.graphics.Matrix());
7676
}
7777

78-
public _createImageSourceFromSrc(value: string | ImageSource) {
78+
public _createImageSourceFromSrc(value: string | ImageSource | ImageAsset) {
7979
const imageView = this.nativeViewProtected;
8080
if (!imageView) {
8181
return;

tns-core-modules/ui/styling/style-properties.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Types
2-
import {
2+
import {
33
Transformation,
44
TransformationValue,
55
TransformFunctionsInfo,
@@ -456,13 +456,13 @@ const TRANSFORMATIONS = Object.freeze([
456456
const STYLE_TRANSFORMATION_MAP = Object.freeze({
457457
"scale": value => ({ property: "scale", value }),
458458
"scale3d": value => ({ property: "scale", value }),
459-
"scaleX": ({x}) => ({ property: "scale", value: { x, y: IDENTITY_TRANSFORMATION.scale.y } }),
460-
"scaleY": ({y}) => ({ property: "scale", value: { y, x: IDENTITY_TRANSFORMATION.scale.x } }),
459+
"scaleX": ({ x }) => ({ property: "scale", value: { x, y: IDENTITY_TRANSFORMATION.scale.y } }),
460+
"scaleY": ({ y }) => ({ property: "scale", value: { y, x: IDENTITY_TRANSFORMATION.scale.x } }),
461461

462462
"translate": value => ({ property: "translate", value }),
463463
"translate3d": value => ({ property: "translate", value }),
464-
"translateX": ({x}) => ({ property: "translate", value: { x, y: IDENTITY_TRANSFORMATION.translate.y } }),
465-
"translateY": ({y}) => ({ property: "translate", value: { y, x: IDENTITY_TRANSFORMATION.translate.x } }),
464+
"translateX": ({ x }) => ({ property: "translate", value: { x, y: IDENTITY_TRANSFORMATION.translate.y } }),
465+
"translateY": ({ y }) => ({ property: "translate", value: { y, x: IDENTITY_TRANSFORMATION.translate.x } }),
466466

467467
"rotate": value => ({ property: "rotate", value }),
468468
});
@@ -501,12 +501,12 @@ export function transformConverter(text: string): TransformFunctionsInfo {
501501
return fullTransformations;
502502
}
503503

504-
const affineMatrix = transformations
504+
const affineMatrix = transformations
505505
.map(getTransformMatrix)
506506
.reduce(multiplyAffine2d)
507-
const cssMatrix = matrixArrayToCssMatrix(affineMatrix)
507+
const cssMatrix = matrixArrayToCssMatrix(affineMatrix)
508508

509-
return decompose2DTransformMatrix(cssMatrix);
509+
return decompose2DTransformMatrix(cssMatrix);
510510
}
511511

512512
// using general regex and manually checking the matched
@@ -528,8 +528,8 @@ function parseTransformString(text: string): Transformation[] {
528528
return matches;
529529
}
530530

531-
function normalizeTransformation({ property, value }: Transformation) {
532-
return STYLE_TRANSFORMATION_MAP[property](value);
531+
function normalizeTransformation({ property, value }: Transformation): Transformation {
532+
return <any>STYLE_TRANSFORMATION_MAP[property](value);
533533
}
534534

535535
function convertTransformValue(property: string, stringValue: string)

0 commit comments

Comments
 (0)