You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-exporting type declaration fails with "transpileOnly": true #1353
I'm not sure, but you may need to split your export {} from onto 2 lines, one being export {} and the other being export type{}
I suggest turning on isolatedModules and then seeing if tsc complains. isolatedModules can be a bit confusing, but essentially it tells the typechecker to complain any time you're doing something that might break in transpileOnly mode.
I expect that isolatedModules will complain, but that you'll be able to fix the problem like this, or something very similar to this:
export { PersonClass } from './lib';
export type { PersonType } from './lib';
Activity
cspotcode commentedon May 28, 2021
I'm not sure, but you may need to split your
export {} fromonto 2 lines, one beingexport {}and the other beingexport type{}I suggest turning on
isolatedModulesand then seeing iftsccomplains.isolatedModulescan be a bit confusing, but essentially it tells the typechecker to complain any time you're doing something that might break intranspileOnlymode.I expect that
isolatedModuleswill complain, but that you'll be able to fix the problem like this, or something very similar to this:cspotcode commentedon May 28, 2021
TypeScript's handbook explains the purpose of isolatedModules very well.
https://www.typescriptlang.org/tsconfig#isolatedModules
dandv commentedon May 28, 2021
Indeed,
isolatedModuleswarns,Explicitly adding the
export typesolved the issue. Thanks @cspotcode!