请问一下,TypeScript面向对象编程。定义了Class,引入Class 和 引入type Class 的区别是什么?
Person.ts
export class Person {
name: string
age: number
height: number
}
在测试代码中:test.ts
import { type Person} from './person.ts'
const p:Person = {
name: '',
age: 0,
height: 0
}
console.log(p)
不管引入:{ type Person }
还是引入{ Person }
,感觉都没有差异。
请问:
1、引入Class 和 引入type Class 的区别是什么?
2、在哪些场景下应该引用type Class
?