簡體   English   中英

如何使用覆蓋重新導出?

[英]How to do re-export with overrides?

export * form 'some-library'
export * from './myOverrides'
// error: [ts] Module 'some-module' has already
// exported a member named 'someFunc'.
// Consider explicitly re-exporting to resolve the ambiguity.

import * as SomeLib from 'some-library'
import * as MyOverrides from './myOverrides'

export { ...SomeLib, ...MyOverrides } // syntax error

const Overridden = { ...someLib, ...MyOverrides } // works
export { ...Overridden } // syntax error

我想避免挑選出所有已命名的出口只是為了將它們重新出口。

import { a, b, c, d, e, ..... } from 'some-library'
export { a, b, c, d, e, .... }
export * from './myOverrides'

來自Guy Sensei:

https://github.com/systemjs/systemjs/issues/1031#issuecomment-171262430

我需要:

import { theFunction } from './myOverrides'

export * from 'some-library'
export { theFunction }

之所以可行,是因為本地出口優先。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM