Skip to content

Commit 206db49

Browse files
committed
MC-3095: Display TypeScript errors within local build process
- Resolve further errors
1 parent cde81c7 commit 206db49

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type-toolbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import $ from "jquery";
77
import ko from "knockout";
88
import events from "uiEvents";
99
import {OptionInterface} from "./content-type-toolbar/option";
10-
import {ValueInterface} from "./content-type-toolbar/value";
10+
import ValueInterface from "./content-type-toolbar/value";
1111
import Preview from "./content-type/preview";
1212

1313
/**
@@ -45,7 +45,7 @@ export default class Toolbar {
4545
* @param {ValueInterface} value
4646
*/
4747
public onOptionClick(option: OptionInterface, value: ValueInterface) {
48-
const defaultValue: string = this.preview.config.fields[option.key].default;
48+
const defaultValue: string = this.preview.config.fields[option.key].default as string;
4949
const currentValue: string = this.preview.parent.dataStore.get(option.key) as string;
5050
this.preview.updateData(option.key, currentValue === value.value ? defaultValue : value.value);
5151
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/block/preview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import events from "uiEvents";
1010
import Config from "../../config";
1111
import ContentTypeInterface from "../../content-type";
1212
import ContentTypeConfigInterface from "../../content-type-config";
13+
import {DataObject} from "../../data-store";
1314
import ContentTypeDroppedCreateEventParamsInterface from "../content-type-dropped-create-event-params";
1415
import ObservableUpdater from "../observable-updater";
1516
import BasePreview from "../preview";
@@ -62,7 +63,7 @@ export default class Preview extends BasePreview {
6263
protected afterObservablesUpdated(): void {
6364
super.afterObservablesUpdated();
6465

65-
const data = this.parent.dataStore.get();
66+
const data = this.parent.dataStore.get() as DataObject;
6667

6768
// Only load if something changed
6869
if (this.lastBlockId === data.block_id && this.lastTemplate === data.template) {
@@ -119,8 +120,8 @@ export default class Preview extends BasePreview {
119120
this.placeholderText(response.data.error);
120121
}
121122

122-
this.lastBlockId = data.block_id;
123-
this.lastTemplate = data.template;
123+
this.lastBlockId = parseInt(data.block_id.toString(), 10);
124+
this.lastTemplate = data.template.toString();
124125
this.lastRenderedHtml = response.data.content;
125126
})
126127
.fail(() => {

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/map/converter/attribute/locations.ts

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

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

89
export default class Locations implements ConverterInterface {
910

@@ -27,7 +28,7 @@ export default class Locations implements ConverterInterface {
2728
* @param data Object
2829
* @returns {string | object}
2930
*/
30-
public toDom(name: string, data: object): string | object {
31+
public toDom(name: string, data: DataObject): string | object {
3132
let content = data[name];
3233
if (typeof content === "string" && content !== "") {
3334
content = JSON.parse(content);

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/slide/converter/style/margins.ts

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

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

89
export default class Margins implements ConverterInterface {
910
/**
@@ -29,12 +30,14 @@ export default class Margins implements ConverterInterface {
2930
/**
3031
* Convert value to knockout format
3132
*
32-
* @param name string
33-
* @param data Object
33+
* @param {string} name
34+
* @param {DataObject} data
3435
* @returns {string | object}
3536
*/
36-
public toDom(name: string, data: object): string | object {
37-
const result = {};
37+
public toDom(name: string, data: DataObject): string | object {
38+
const result: {
39+
[key: string]: string;
40+
} = {};
3841
let value = data[name];
3942
if (value && typeof value === "string") {
4043
value = JSON.parse(value);

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/slide/converter/style/paddings.ts

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

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

89
export default class Paddings implements ConverterInterface {
910
/**
@@ -36,12 +37,14 @@ export default class Paddings implements ConverterInterface {
3637
/**
3738
* Convert value to knockout format
3839
*
39-
* @param name string
40-
* @param data Object
40+
* @param {string} name
41+
* @param {DataObject} data
4142
* @returns {string | object}
4243
*/
43-
public toDom(name: string, data: object): string | object {
44-
const result = {};
44+
public toDom(name: string, data: DataObject): string | object {
45+
const result: {
46+
[key: string]: string;
47+
} = {};
4548
let value = data[name];
4649
if (value && typeof value === "string") {
4750
value = JSON.parse(value);

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/converter/style/paddings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ export default class Paddings implements ConverterInterface {
5252
}
5353
return result;
5454
}
55-
}
55+
}

0 commit comments

Comments
 (0)