refactor(editor): Fix typescript issues in components (no-changelog) (#9580)

This commit is contained in:
Elias Meire
2024-05-31 16:27:56 +02:00
committed by GitHub
parent e23420d89d
commit 3227f6c13e
20 changed files with 57 additions and 58 deletions

View File

@@ -40,7 +40,7 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { type StyleValue, defineComponent, type PropType } from 'vue';
import type { ITemplatesNode } from '@/Interface';
import type { INodeTypeDescription } from 'n8n-workflow';
@@ -50,6 +50,7 @@ import { useRootStore } from '@/stores/n8nRoot.store';
interface NodeIconData {
type: string;
path?: string;
icon?: string;
fileExtension?: string;
fileBuffer?: string;
}
@@ -69,7 +70,8 @@ export default defineComponent({
default: false,
},
nodeType: {
type: Object,
type: Object as PropType<INodeTypeDescription>,
required: true,
},
size: {
type: Number,
@@ -82,9 +84,11 @@ export default defineComponent({
'max-width': this.size + 'px',
};
},
iconStyleData(): object {
const nodeType = this.nodeType as ITemplatesNode | null;
const color = nodeType ? nodeType.defaults && nodeType.defaults.color : '';
iconStyleData(): StyleValue {
const nodeType = this.nodeType;
const nodeTypeColor = nodeType?.defaults?.color;
const color = typeof nodeTypeColor === 'string' ? nodeTypeColor : '';
if (!this.size) {
return { color };
}
@@ -103,7 +107,7 @@ export default defineComponent({
}),
};
},
imageStyleData(): object {
imageStyleData(): StyleValue {
return {
width: '100%',
'max-width': '100%',