構造を変えれば区別できる
code:ts
class Vec4d {
x=0; y=0; z=0; w=0;
}
class Queartanion {
x=0; y=0; z=0; w=0;
}
let x = new Vec4d();
const y = new Queartanion();
x = y; // OK
code:ts
class Vec4d {
x=0; y=0; z=0; w=0;
isVector=true;
}
class Queartanion {
x=0; y=0; z=0; w=0;
isQueartanion=true;
}
let x = new Vec4d();
const y = new Queartanion();
x = y; // Property 'isVector' is missing in type 'Queartanion' but required in type 'Vec4d'.
code:python
class Vec4 {
x=0; y=0; z=0; w=0;
}
class Queartanion {
s=0; x=0; y=0; z=0;
}
let x = new Vec4();
const y = new Queartanion();
x = y; // Property 'w' is missing in type 'Queartanion' but required in type 'Vec4'.
TypeScriptの型