Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support importing/exporting .d.ts files #203

Open
pi0 opened this issue Feb 3, 2021 · 3 comments
Open

support importing/exporting .d.ts files #203

pi0 opened this issue Feb 3, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@pi0
Copy link

pi0 commented Feb 3, 2021

πŸ› The bug
What isn't working? Describe what the bug is.

πŸ› οΈ To reproduce

  • Create src/types.d.ts
  • Inside src/index.ts:
export * from './types'

siroc build:

[UNRESOLVED_IMPORT] Could not resolve './types' from src/index.ts

🌈 Expected behaviour

Types exportable from .d.ts files

ℹ️ Additional context

We can fix this issue by renaming types to types.ts or using export type {} from './types' (with .d.ts). Downside of first is that it is not semantic and types are not usable in typescript config and for second, when there are lots of types, named exports are hard. BTW not sure even this is something fixable by siroc but tought mentioning if there is a workaround.

@pi0 pi0 added the bug Something isn't working label Feb 3, 2021
@danielroe
Copy link
Owner

Interesting question. I'm not sure we should be able to import/export dts files. I think we should always be operating with .ts files and generating the dts files in the build stage.

@danielroe danielroe changed the title fix: support importing/exporting .d.ts files Feb 7, 2021
@pi0
Copy link
Author

pi0 commented Feb 24, 2021

@danielroe of course we should never include .d.ts in import path to match runtime. Issue is that with siroc we cannot export from .d.ts files even when there is no extension in import path and forced to use .ts :)

Interesting question. I'm not sure we should be able to import/export dts files. I think we should always be operating with .ts files and generating the dts files in the build stage.

This is not always best option. src/dts files are can be usable for linked demo and tests in their tsconfig. Otherwise we need to force a dry build step or add duplicate shims

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants