如何从打字稿中的文件中导入对象的对象

问题描述 投票:0回答:2

如何从打字稿中的文件中导入对象的对象。我知道我可以像import house from 'a/b/c/house'一样导入。但是我可以只导入parent吗?所以我不需要像这样写代码house.grandparent.parent.xxx

#filepath: a/b/c/house.ts
const house = {
  grandparent: {
    parent: {
      childa: (text: string) => `s'${text}')`,
      childb: 'b',
      childc: 'c',
    },
  },
};

export default house;
javascript typescript typescript2.0 typescript1.8
2个回答
0
投票

0
投票
© www.soinside.com 2019 - 2024. All rights reserved.