LoginSignup
3
0

TypeScript – ファイルから import した定数をそのまま export する

Posted at

コード例

importは書かずに export だけ書けば成り立つようだ

export {
  FOO_CONSTANT,
  BAR_CONSTANT,
} from 'foo_file'

解説

次のように import した定数をそのままexportしたかった
(以下は文法エラー)

import {
  FOO_CONSTANT,
  BAR_CONSTANT,
} from 'foo_file'

export const FOO_CONSTANT = FOO_CONSTANT
export const BAR_CONSTANT = BAR_CONSTANT

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

プロフィール・経歴

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0