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

fix(types): directives without arguments but with modifiers #6429

Closed
wants to merge 1 commit into from

Conversation

lishixuan13
Copy link

fix #6427

<input v-model.trim="msg" />

/**
 * after compilation
 * 
 * [
 *    vModelText,
 *    msg.value,
 *    void 0,
 *    { trim: true }
 * ]
 */

error :

TS2322: Type '[ModelDirective<HTMLInputElement | HTMLTextAreaElement>, any, undefined, { trim: true; }]' is not assignable to type '[Directive<any, any>] | [Directive<any, any>, any] | [Directive<any, any>, any, string] | [Directive<any, any>, any, string, DirectiveModifiers]'.
  Type '[ModelDirective<HTMLInputElement | HTMLTextAreaElement>, any, undefined, { trim: true; }]' is not assignable to type '[Directive<any, any>, any, string, DirectiveModifiers]'.
    Type at position 2 in source is not compatible with type at position 2 in target.
      Type 'undefined' is not assignable to type 'string'.

@lishixuan13 lishixuan13 changed the title fix(types): directives without arguments but with modifiers #6427 #4780 fix(types): directives without arguments but with modifiers Aug 9, 2022
@skirtles-code
Copy link
Contributor

Looks good to me. Might be worth adding a test for this scenario to directives.spec.ts.

The original bug report was about webpack and compiler-generated code, but I believe this type change would also be useful when writing render functions directly with "strict": true. e.g. Playground.

@edison1105
Copy link
Member

Thanks for the PR, but sorry, we saw this PR too late. This issue has already been fixed in #11540.
see #11540

@edison1105 edison1105 closed this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

Unable to use directives without arguments but with modifiers due to type error in vue
4 participants