≡

TypeScript: layout.features rejects mixed strings and configuration objects

TypeScript: layout.features rejects mixed strings and configuration objects

peter.brunspeter.bruns Posts: 7Questions: 5Answers: 0

Link to test case: https://stackblitz.com/edit/vitejs-vite-mzsu84ci?file=src%2Fmain.ts&terminal=dev

Hi,

I'm using DataTables 3.1.4 with TypeScript.

The documentation describes features as an array accepting feature strings and configuration objects. However, mixing both in the same array produces a TypeScript error.

import type { Options } from 'datatables.net-dt';

const config: Options = {
  layout: {
    top1: {
      features: ['search', { div: {} }],
    },
  },
};

The configuration works at runtime, and replacing search with { search: {} } resolves the type error.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 66,088Questions: 1Answers: 11,012 Site admin
    Answer ✓

    Again thank you :). I've committed this fix to address the error. It will also be in the next patch release.

    Allan

Sign In or Register to comment.