import fromとexport from、よく分からなくなるのでまとめました。 ファイル関係図 登場人物 child1.ts, child2.ts - 【子モジュール】メインプログラムで使える変数をexportする parent.ts - 【親モジュール】小モジュール2つをまとめてexportし直す main.ts - 【メインプログラム】親モジュールをimportして使う 関係図 左が右を読み込む。 ↓(実行主体) main.ts ← parent.ts ← child1.ts ← child2.ts 子モジュール定義 // child1.ts export const hoge = 'hoge' export const fuga = 'fuga' export default 'default1' // child2.ts export const foo = 'foo' ex
