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

Improve Effect imports #48

Merged
merged 11 commits into from
Dec 8, 2023
Merged

Conversation

wmaurer
Copy link
Contributor

@wmaurer wmaurer commented Nov 30, 2023

This PR improves Effect imports, removing support for detection of imports from @effect/io in favour of from effect.

The current version only supports detecting namespace imports.
With this PR, named imports are also supported:

import { Effect } from 'effect';
import { Effect as T } from 'effect';

Detection of namespace imports and named imports from effect is done statically using the AST.

If no namespace or named import can be found, a further check for re-exports is made using the typechecker, where the exports of each imported module is checked to see if there's an entry in the map with key Effect.

So given reExport.ts:

export * as Eff from 'effect/Effect';

then Eff (as Effect) is correctly detected:

import { Eff } from './reExport';

Copy link

changeset-bot bot commented Nov 30, 2023

🦋 Changeset detected

Latest commit: 18db525

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/language-service Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IMax153 IMax153 force-pushed the improve-effect-imports branch 5 times, most recently from 9976eb2 to 16f3768 Compare December 2, 2023 18:48
@IMax153 IMax153 force-pushed the improve-effect-imports branch from 16f3768 to 554570c Compare December 2, 2023 18:54
fubhy and others added 6 commits December 7, 2023 12:12
…ntional formatting in examples. Fixed tests. Refactored asyncAwaitToGen to work with current Effect API. Added plugin option `preferredEffectGenAdapterName`
@wmaurer
Copy link
Contributor Author

wmaurer commented Dec 8, 2023

I think this PR should be ready to go now, pending a review from @mattiamanzati
Thanks very much to @IMax153 and @fubhy for their help in modernising the repo setup!

@IMax153 IMax153 merged commit 9bb0011 into Effect-TS:main Dec 8, 2023
3 checks passed
@github-actions github-actions bot mentioned this pull request Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants