untyped icon indicating copy to clipboard operation
untyped copied to clipboard

inferred function type is wrong

Open danielroe opened this issue 3 years ago • 1 comments

For example, @nuxt/kit:

  globals: {
    id: () => any,
    nuxt: () => any,
    context: () => any,
    pluginPrefix: () => any,
    readyCallback: () => any,
    loadedCallback: () => any,
  }

from:

  globals: {
    id: globalName => `__${globalName}`,
    nuxt: globalName => `$${globalName}`,
    context: globalName => `__${globalName.toUpperCase()}__`,
    pluginPrefix: globalName => globalName,
    readyCallback: globalName => `on${pascalCase(globalName)}Ready`,
    loadedCallback: globalName => `_on${pascalCase(globalName)}Loaded`
  }

danielroe avatar Jun 15 '21 19:06 danielroe

repro

  • any should be Function
  • for nuxt kit usage, we need comments to fine-tune types (Function|String)

pi0 avatar Jun 16 '21 12:06 pi0