question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`d.ts` missing property.

See original GitHub issue

Hello, @timocov
first thx you for your hard work to create this package. it was pretty convenient to bundle a single ts without pain. I installed dts-bundle-generator globally, and clone the following package, and then add npm i @types/react --save-dev to fix the missing dependency. https://github.com/chakra-ui/chakra-ui/tree/main/packages/visually-hidden

After the generation without any problems, I get the following .d.ts files, it’s very legit.

// Generated by dts-bundle-generator v6.0.0

import * as React from 'react';

/**
 * Styles to visually hide an element
 * but make it accessible to screen-readers
 */
export declare const visuallyHiddenStyle: React.CSSProperties;
/**
 * Visually hidden component used to hide
 * elements on screen
 */
export declare const VisuallyHidden: import("@chakra-ui/system").ChakraComponent<"span", {}>;
/**
 * Visually hidden input component for designing
 * custom input components using the html `input`
 * as a proxy
 */
export declare const VisuallyHiddenInput: import("@chakra-ui/system").ChakraComponent<"input", {}>;

export {};

But when I check the original files, I found out that there are some properties with literal was missing from the .d.ts files. https://github.com/chakra-ui/chakra-ui/blob/a0de717c98e574e73f8a444f576fc738907230ab/packages/visually-hidden/src/visually-hidden.tsx#L9

May I know why the part of properties was strip away after creation.

My tsconfig:

{
    "lib": ["dom", "esnext"],
    "allowSyntheticDefaultImports": true,
    "jsx": "react"
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
aboveyunhaicommented, Nov 20, 2021

this kinds of initializer is invalid in typescript

@aboveyunhai Not exactly. This kind of initializer is invalid in declaration files only since they make no sense for anybody It doesn’t matter what values are there, the more important is what types (this is the purpose of typings). Declaration files are about types, not about an actual values.

it’s more act like a description hint in this case

Not sure that get what you meant here.

Thx, my bad, you are right. I forgot it’s declaration file and mess it up with regular typescript files. Appreciate your patience to answer my silly questions

0reactions
timocovcommented, Nov 20, 2021

this kinds of initializer is invalid in typescript

@aboveyunhai Not exactly. This kind of initializer is invalid in declaration files only since they make no sense for anybody It doesn’t matter what values are there, the more important is what types (this is the purpose of typings). Declaration files are about types, not about an actual values.

it’s more act like a description hint in this case

Not sure that get what you meant here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with missing property in lib.dom.d.ts file when update ...
ts(93,63): error TS2339: Property 'localName' does not exist on type 'Node'. I have found the definition of the Node type in the lib.dom.d.ts...
Read more >
File is missing properties definition ! in lib.webworker.d.ts
type File is missing some property , like path where we can use inside nwjs or electron desktop app. see https://github.com/microsoft/TypeScript ...
Read more >
typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ...
Read more >
Documentation - Utility Types - TypeScript
Property 'b' is missing in type '{ a: number; }' but required in type ... ThisType<T> marker interface is simply an empty interface...
Read more >
TypeScript errors and how to fix them
error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or ... We have to add the missing properties to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found