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

Bug: Fast check cannot infer type from this export #22802

Closed
marvinhagemeister opened this issue Mar 8, 2024 · 1 comment · Fixed by #22849
Closed

Bug: Fast check cannot infer type from this export #22802

marvinhagemeister opened this issue Mar 8, 2024 · 1 comment · Fixed by #22849
Labels
bug Something isn't working correctly

Comments

@marvinhagemeister
Copy link
Contributor

marvinhagemeister commented Mar 8, 2024

Fast check should be able to infer the type here:

export const middlewareMarker = 'middlewareMarker' as 'middlewareMarker' & {
  __brand: 'middlewareMarker';
};

It's a simple as <Type> expression so the expected output should be:

export const middlewareMarker: 'middlewareMarker' & {
  __brand: 'middlewareMarker';
};

Error:

error[missing-explicit-type]: missing explicit type in the public API
  --> /Users/marvinh/dev/oss/trpc/packages/server/src/core/internals/utils.ts:45:14
   | 
45 | export const middlewareMarker = 'middlewareMarker' as 'middlewareMarker' & {
   |              ^^^^^^^^^^^^^^^^ this symbol is missing an explicit type
   = hint: add an explicit type annotation to the symbol

  info: all symbols in the public API must have an explicit type
  docs: https://jsr.io/go/slow-type-missing-explicit-type

Version: Deno 1.41.1

@marvinhagemeister marvinhagemeister added the bug Something isn't working correctly label Mar 8, 2024
@marvinhagemeister
Copy link
Contributor Author

I addressed these things in the DTS transform for JSR but it looks like it errors out earlier in fast check. For named exports we can basically copy the type annotation from the TsAsExpression and for default exports we need to create a temporary variable and copy the type annotation to there.

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

Successfully merging a pull request may close this issue.

1 participant