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.

`declarationDir` compiler option fails generation

See original GitHub issue

I am trying to bundle type definitions, but get the following error TS6053: File 'src/index.d.ts' not found. I run yarn dts-bundle-generator --external-imports=react --out-file lib/index.d.ts src/index.ts and it fails with this error.

My src/index.ts is just a simple import of reusable React components:

export {
  Body,
  Headline,
} from './Text';

src/Text/index.ts content is

export { default as Body } from './Body';
export { default as Headline } from './Headline';

src/Text/Body.tsx content is similar in both files:

import React, {
  FC,
} from 'react';
import classNames from 'classnames';

import { TextProps } from './TextProps';

import styles from './Text.css';

const Body: FC<TextProps> = ({
  ...
}) => (
  <span ... />
);

export default Body;

Why does it need src/index.d.ts at all? I works fine if I run tsc to generate definition file for each ts/tsx file and use dts-bundle-generator later with yarn dts-bundle-generator --external-imports=react --out-file lib/index.d.ts lib/src/index.d.ts

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timocovcommented, Feb 11, 2021

The fix is just published with 5.7.0 version.

0reactions
igorpupkinablecommented, Feb 23, 2021

It works. Thank you for fixing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
Specifies an allowlist of files to include in the program. An error occurs if any of the files can't be found. {. "...
Read more >
rollup esm and umd builds, with typescript plugin and ...
I had a first error because of the configuration propery only rollup-plugin-typescript2 understands: "(!) Plugin typescript: @rollup/plugin- ...
Read more >
Warning Options - Using the GNU Compiler Collection (GCC)
Make all warnings into errors. -Werror= Make the specified warning into an error. The specifier for a warning is appended, for example -Werror ......
Read more >
rollup-plugin-typescript2 - npm.io
This plugin inherits all compiler options and file lists from your tsconfig.json file. ... declarationDir : Rollup's output.file or output.dir (unless ...
Read more >
Integrating TypeScript with Webpack | by Uday Hiwarale
If you haven't read the TypeScript Compilation lesson, ... to true in the tsconfig.json along with declarationDir compiler-option.
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