Skip to content

Instantly share code, notes, and snippets.

@idkiller
Created March 15, 2019 05:57
Show Gist options
  • Save idkiller/18b5f5d64ffee6337ee6d1fef6b91d6e to your computer and use it in GitHub Desktop.
Save idkiller/18b5f5d64ffee6337ee6d1fef6b91d6e to your computer and use it in GitHub Desktop.
import {fabric} from 'fabric';
declare module 'fabric' {
namespace fabric {
interface Object {
id: string;
depth?: number;
formulaX?: string;
formulaY?: string;
formulaWidth?: string;
formulaHeight?: string;
formulaRotation?: string;
syncWithVariable?: string;
}
interface IObjectOptions {
canvas?: fabric.Canvas
}
}
}
let foobar: fabric.Object = ...;
foo.id = 'blarblar'; // OK
const left = foo.get('left'); // OK
<template>
...
</template>
<script lang="ts">
import {fabric} from 'fabric';
import canvasManager from "../CanvasManager";
let xxx: fabric.Object = ...;
xxx.id = 'xxxxxxx'; // OK
const left = xxx.get('left'); // Error fabric.Object is from canvasMaanger... not fabric
</script>
<css>
</css>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment