support icon indicating copy to clipboard operation
support copied to clipboard

[BUG] Vue Calendar package.json does not specify types

Open ZainW opened this issue 3 months ago • 5 comments

Description

The @bryntum/calendar-vue-3 package is missing the types field in its package.json, and its type definition file (lib/index.d.ts) incorrectly re-exports from source files instead of compiled type definitions. This causes TypeScript to analyze the library's source .vue and .ts files, which fail strict mode type checking when used with @vue/tsconfig v0.8.0 or higher.

Steps to Reproduce

This issue occurs during TypeScript compilation, not in a running demo. To reproduce:

  1. Create a Vue 3 project with TypeScript
  2. Install @bryntum/[email protected]
  3. Use @vue/tsconfig@^0.8.0 (which enables strict TypeScript checks)
  4. Import and use BryntumCalendar component in your code
  5. Run vue-tsc --build or any TypeScript type-checking command
  6. Observe TypeScript errors from Bryntum's source files in node_modules

Example TypeScript errors:

node_modules/.pnpm/@[email protected]/node_modules/@bryntum/calendar-vue-3/src/components/BryntumDemoHeader.vue(57,21): error TS2532: Object is possibly 'undefined'.
node_modules/.pnpm/@[email protected]/node_modules/@bryntum/calendar-vue-3/src/components/BryntumDemoHeader.vue(70,43): error TS2532: Object is possibly 'undefined'.
node_modules/.pnpm/@[email protected]/node_modules/@bryntum/calendar-vue-3/src/helper/WrapperHelper.ts(122,40): error TS2532: Object is possibly 'undefined'.

Expected Behavior

  1. The package.json should include a types field pointing to the main type definition file:

    {
      "types": "./lib/index.d.ts"
    }
    
  2. The lib/index.d.ts file should re-export from compiled type definitions, not source files:

    // Current (incorrect):
    export { default as BryntumCalendar } from '../src/components/BryntumCalendar.vue';
    export * from '../src/components/BryntumCalendarProps';
    
    // Expected (correct):
    export { default as BryntumCalendar } from './components/BryntumCalendar.vue.d.ts';
    export * from './components/BryntumCalendarProps';
    
  3. TypeScript should only analyze the compiled .d.ts files, not the source .vue and .ts files, preventing strict mode errors from the library's internal implementation.

  4. no typechecking of the node_modules

Actual Behavior

  1. package.json lacks the types field, causing TypeScript to fall back to heuristic module resolution
  2. lib/index.d.ts uses paths like '../src/components/*.vue', forcing TypeScript to load and check source files
  3. TypeScript applies strict checks to Bryntum's source code, causing compilation failures with errors like "Object is possibly 'undefined'"

Screenshots / Logs

Current package.json (missing types field):

{
  "name": "@bryntum/calendar-vue-3",
  "version": "6.3.3",
  "type": "module",
  "main": "./lib/index.js",
  "module": "./lib/index.js"
  // Missing: "types": "./lib/index.d.ts"
}

Current lib/index.d.ts (incorrect paths):

export { default as BryntumFullscreenButton } from '../src/components/BryntumFullscreenButton.vue';
export { default as BryntumDemoHeader } from '../src/components/BryntumDemoHeader.vue';
export { default as BryntumAgendaView } from '../src/components/BryntumAgendaView.vue';
// ... 167 lines total, all pointing to ../src/ instead of ./components/

Environment

  • OS: macOS (Darwin 24.6.0)
  • Node.js: v22.20.0
  • TypeScript: ~5.9.3
  • Bryntum Version: @bryntum/[email protected]
  • vue-tsc: 3.0.8
  • @vue/tsconfig: 0.8.1

Additional Context

expectation is for the proper exporting of the types

typechecking performance is also horrible due to this issue

Suggested Fix: Update the build process to:

  1. Add "types": "./lib/index.d.ts" to package.json
  2. Generate lib/index.d.ts with relative paths to compiled definitions (e.g., ./components/*.vue.d.ts) instead of source files (e.g., ../src/components/*.vue)

ZainW avatar Oct 15 '25 20:10 ZainW

Ok. Thank you for the suggestion. We will add types

Regarding index.d.ts

export { default as BryntumFullscreenButton } from '../src/components/BryntumFullscreenButton.vue';

Targets BryntumFullscreenButton.vue.d.ts, which is an omitted d.ts extension in import

SergeyMaltsev avatar Oct 17 '25 02:10 SergeyMaltsev

Ok. Thank you for the suggestion. We will add types

Regarding index.d.ts

export { default as BryntumFullscreenButton } from '../src/components/BryntumFullscreenButton.vue';

Targets BryntumFullscreenButton.vue.d.ts, which is an omitted d.ts extension in import

Awesome thank you! Is it something we can expect in a patch version of the Vue dependency?

ZainW avatar Oct 18 '25 05:10 ZainW

We will try to do it in next 6.3.4 patch.

SergeyMaltsev avatar Oct 21 '25 08:10 SergeyMaltsev

Fyi: @bryntum/schedulerpro-vue-3 seems to be also affected leading to similar errors. Can this be fixed?

Duske avatar Oct 30 '25 10:10 Duske

It is fixed for all packages. Will be released with 6.3.4 version

SergeyMaltsev avatar Oct 31 '25 03:10 SergeyMaltsev