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

got error when using Icon.createFromIconfontCN with typescript #3474

Closed
1 task done
LSYUN opened this issue Dec 31, 2020 · 4 comments
Closed
1 task done

got error when using Icon.createFromIconfontCN with typescript #3474

LSYUN opened this issue Dec 31, 2020 · 4 comments

Comments

@LSYUN
Copy link

LSYUN commented Dec 31, 2020

  • I have searched the issues , with one similar issue, but no solution.

Version

2.0.0-rc.7

Environment

Vue3.0.0, typescript3.9.3

Reproduction link

https://2x.antdv.com/components/icon-cn/#components-icon-demo-use-iconfont.cn

Steps to reproduce

// my code, similar with antdv example
import { createFromIconfontCN } from '@ant-design/icons-vue';

const IconFont = createFromIconfontCN({
  scriptUrl: config.iconfontUrl
});
export default defineComponent({
  components: {
    IconFont
  }
});

// compilation 
/*
TS2769: No overload matches this call.
  The last overload gave the following error.
    Type 'Function' is not assignable to type 'Component<any, any, any, Record<string, ComputedGetter<any> | WritableComputedOptions<any>>, MethodOptions>'.
      Type 'Function' is not assignable to type 'ComponentOptions<any, any, any, Record<string, ComputedGetter<any> | WritableComputedOptions<any>>, MethodOptions, any, any, any
>'.
        Type 'Function' is not assignable to type 'ComponentOptionsBase<any, any, any, Record<string, ComputedGetter<any> | WritableComputedOptions<any>>, MethodOptions, ... 4 m
ore ..., {}>'.
          Types of property 'call' are incompatible.
            Type '(this: Function, thisArg: any, ...argArray: any[]) => any' is not assignable to type '(this: unknown, ...args: unknown[]) => never'.
              The 'this' types of each signature are incompatible.
                Type 'unknown' is not assignable to type 'Function'.

  >  99 |     IconFont,
        |     ^^^^^^^^
*/


What is expected?

fix the error

What is actually happening?

compilation fails

@lhcGinv
Copy link

lhcGinv commented Jan 5, 2021

I got this error too

@tangjinzhou
Copy link
Member

临时修复

const IconFont = createFromIconfontCN({
  scriptUrl: '',
}) as any;

@tangjinzhou
Copy link
Member

tangjinzhou commented Jan 7, 2021

升级 @ant-design/icons-vue 到 5.1.9

@github-actions
Copy link

github-actions bot commented Jan 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants