bug: re-open of issue #2769 / components.d.ts missing types

Open
#3,239 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
build-system

Research direction

Start by comparing the first and second builds described in the issue, using src/components.d.ts, dist/types/components.d.ts, and dist/types/components as the observable outputs. Review the related behavior in issue #2769, then reproduce with the listed npm init stencil steps; done means the first build includes all component types and has no broken import.

Written by the indexing model from the issue text.

Description

Bug: Validated

Stencil version:

 @stencil/core@2.13.0

Current behavior:
The behaviour is best documented in the closed ticket (by bot due to inactivity) the Issue remains un-solved - please have a look at https://github.com/ionic-team/stencil/issues/2769

Copycat:
If there is no src/components.d.ts file present, and one component (A) references another's type (B)...

On first build, the types are not generated for (A) in the output directory dist/types/components. If (A) exports any types, this can also result in broken imports in dist/types/components.d.ts. No error is reported during build.

On second build (where there is now a src/components.d.ts present as a result of the first build), the types are generated for (A) in the output directory dist/types/components.

I do not like committing auto-generated files to source control, as they result in needless churn, hence why i do not have src/components.d.ts (this was a fresh clone of my repo).

Expected behavior:
All Types are present in the first compile of components.d.ts, when no components.d.ts is present in the first place.

Copycat:
Ideally it should Just Work(tm), and not rely on committing auto-generated files to source control. On both the first (broken) build and the second (successful) build, the src/components.d.ts file is exactly the same, so it may be a timing/ordering issue?

An alternative would simply be to raise an error in this case.

Steps to reproduce:

  1. create new stencil project with npm init stencil
  2. rm src/components.d.ts
  3. add the components from the Related code section below
  4. npm run build
  5. open dist/types/components.d.ts and see a broken import
  6. ls dist/types/components/ and notice there are no types for my-other-component

Related code:
please have a look at https://github.com/ionic-team/stencil/issues/2769

Dominant language
TypeScript
Stars
13.1k
Forks
855
Avg merge
4h 7m
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stenciljs/core

All issues in stenciljs/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.