Skip to content

Commit 07d6c6c

Browse files
committed
MC-3095: Display TypeScript errors within local build process
- Update data argument to be of type DataObject in implemented coverters
1 parent a46fe81 commit 07d6c6c

File tree

14 files changed

+44
-24
lines changed

14 files changed

+44
-24
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/attribute/link-href.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55
import _ from "underscore";
6+
import {DataObject} from "../../data-store";
67
import ConverterInterface from "../converter-interface";
78

89
/**
@@ -12,7 +13,15 @@ export default class CreateValueForHref implements ConverterInterface {
1213
/**
1314
* @type object
1415
*/
15-
private widgetParamsByLinkType: object = {
16+
private widgetParamsByLinkType: {
17+
[key: string]: {
18+
type: string;
19+
page_id?: string;
20+
id_path?: string;
21+
template: string;
22+
type_name: string;
23+
};
24+
} = {
1625
category: {
1726
type: "Magento\\Catalog\\Block\\Category\\Widget\\Link",
1827
id_path: `category/:href`,
@@ -50,7 +59,7 @@ export default class CreateValueForHref implements ConverterInterface {
5059
* @param data Object
5160
* @returns {string}
5261
*/
53-
public toDom(name: string, data: object): string {
62+
public toDom(name: string, data: DataObject): string {
5463

5564
const link = data[name];
5665
let href = "";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/attribute/link-target.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import {DataObject} from "../../data-store";
67
import ConverterInterface from "../converter-interface";
78

89
/**
@@ -26,7 +27,7 @@ export default class CreateValueForTarget implements ConverterInterface {
2627
* @param data Object
2728
* @returns {string}
2829
*/
29-
public toDom(name: string, data: object): string {
30+
public toDom(name: string, data: DataObject): string {
3031
if (!data[name]) {
3132
return "";
3233
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/attribute/link-type.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import {DataObject} from "../../data-store";
67
import ConverterInterface from "../converter-interface";
78

89
/**
@@ -27,7 +28,7 @@ export default class CreateValueForLinkType implements ConverterInterface {
2728
* @param data Object
2829
* @returns {string}
2930
*/
30-
public toDom(name: string, data: object): string {
31+
public toDom(name: string, data: DataObject): string {
3132

3233
return data[name] ? data[name].type : "";
3334
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/attribute/preview/src.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import {DataObject} from "../../../data-store";
67
import ConverterInterface from "../../converter-interface";
78

89
/**
@@ -26,7 +27,7 @@ export default class Src implements ConverterInterface {
2627
* @param data Object
2728
* @returns {string}
2829
*/
29-
public toDom(name: string, data: object): string {
30+
public toDom(name: string, data: DataObject): string {
3031
const value = data[name];
3132
if (value && typeof value[0] === "object") {
3233
return value[0].url;

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/attribute/src.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import Config from "../../config";
7+
import {DataObject} from "../../data-store";
78
import {decodeUrl} from "../../utils/image";
89
import {convertUrlToPathIfOtherUrlIsOnlyAPath} from "../../utils/url";
910
import ConverterInterface from "../converter-interface";
@@ -32,7 +33,7 @@ export default class Src implements ConverterInterface {
3233
* @param data Object
3334
* @returns {string}
3435
*/
35-
public toDom(name: string, data: object): string {
36+
public toDom(name: string, data: DataObject): string {
3637
const value = data[name];
3738
if (value[0] === undefined || value[0].url === undefined) {
3839
return "";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/converter-interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {DataObject} from "../data-store";
88
/**
99
* @api
1010
*/
11-
export interface ConverterInterface {
11+
export default interface ConverterInterface {
1212
/**
1313
* Convert value to internal format
1414
*

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/converter-pool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
import {ConverterInterface} from "./converter-interface";
6+
import ConverterInterface from "./converter-interface";
77

88
/**
99
* @api

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/html/directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import {DataObject} from "../../data-store";
67
import {convertMediaDirectivesToUrls, removeQuotesInMediaDirectives} from "../../utils/directives";
78
import ConverterInterface from "../converter-interface";
89

@@ -27,7 +28,7 @@ export default class Directives implements ConverterInterface {
2728
* @param {Object} data
2829
* @returns {string}
2930
*/
30-
public toDom(name: string, data: object): string {
31+
public toDom(name: string, data: DataObject): string {
3132
return convertMediaDirectivesToUrls(removeQuotesInMediaDirectives(data[name]));
3233
}
3334
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/style/background-image.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import Config from "../../config";
7+
import {DataObject} from "../../data-store";
78
import {toDataUrl} from "../../utils/directives";
89
import {decodeUrl} from "../../utils/image";
910
import {convertUrlToPathIfOtherUrlIsOnlyAPath} from "../../utils/url";
@@ -33,7 +34,7 @@ export default class BackgroundImage implements ConverterInterface {
3334
* @param data Object
3435
* @returns {string}
3536
*/
36-
public toDom(name: string, data: object): string {
37+
public toDom(name: string, data: DataObject): string {
3738
const value = data[name];
3839
if (value[0] === undefined || value[0].url === undefined) {
3940
return "";

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/style/border-width.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
import {DataObject} from "../../data-store";
67
import ConverterInterface from "../converter-interface";
78

89
/**
@@ -22,11 +23,11 @@ export default class BorderWidth implements ConverterInterface {
2223
/**
2324
* Convert value to knockout format
2425
*
25-
* @param name string
26-
* @param data Object
26+
* @param {string} name
27+
* @param {DataObject} data
2728
* @returns {string | object}
2829
*/
29-
public toDom(name: string, data: object): string | object {
30+
public toDom(name: string, data: DataObject): string | object {
3031
if (data[name]) {
3132
return data[name] + "px";
3233
}

0 commit comments

Comments
 (0)