命名空间
namespace Person {
export let name = "张三";
export function sayHi() {
console.log("你好1");
}
}
namespace Person1 {
export namespace Person2 {
export let name = "李四";
export function sayHi() {
console.log("你好1");
}
}
}
namespace Person3 {
export let age = 18;
}
namespace Person3 {
export let sex = '男';
}
console.log(Person3.age, Person3.sex);
namespace ios {
export const pushNotification = (msg: string) => {
};
}
namespace android {
export const pushNotification = (msg: string) => {
};
}
模块解析
export default 1
export let x = 1
export let arr = [1,2,3]
import xxx, {x, arr} from './test'
import * as test from './test'
console.log(xxx,x,arr)
console.log(test.default)
import('./test').then(res => {
console.log('动态引入', res)
})