Skip to content

String completions fail when they depend on the contextual signature #53073

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

Closed
Andarist opened this issue Mar 3, 2023 · 0 comments Β· Fixed by #52717
Closed

String completions fail when they depend on the contextual signature #53073

Andarist opened this issue Mar 3, 2023 · 0 comments Β· Fixed by #52717
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@Andarist
Copy link
Contributor

Andarist commented Mar 3, 2023

Bug Report

πŸ”Ž Search Terms

completions string return contextual signature

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

type ActorRef<TEvent extends { type: string }> = {
  send: (ev: TEvent) => void;
};

type Action<TContext> = {
  (ctx: TContext): void;
};

type Config<TContext> = {
  entry: Action<TContext>;
};

declare function createMachine<TContext>(config: Config<TContext>): void;

type EventFrom<T> = T extends ActorRef<infer TEvent>
  ? TEvent
  : never;

declare function sendTo<TContext, TActor extends ActorRef<any>>(
  actor: (ctx: TContext) => TActor,
  event: EventFrom<TActor>
): Action<TContext>;

createMachine<{
  child: ActorRef<{ type: "EVENT" }>;
}>({
  entry: sendTo((ctx) => ctx.child, { type: /*1*/ }),
});
createMachine<{
  child: ActorRef<{ type: "EVENT" }>;
}>({
  entry: sendTo((ctx) => ctx.child, { type: "/*2*/" }),
});

πŸ™ Actual behavior

At marker 2 TypeScript fails to provide a string completion

πŸ™‚ Expected behavior

I expect the string completion at marker 2 to behave in the same way as the regular completion at marker 1

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Experience Enhancement Noncontroversial enhancements labels Mar 7, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants