Package breaks TypeScript 2.4.2 project with broken .d.ts validation
See original GitHub issueAssuming latest TypeScript (2.4.2 atm) is globally installed (meaning, tsc
command is available):
mkdir test
// create empty dircd test
// enter the diryarn init -y
// initializepackage.json
fileyarn add popper.js
// add popper.jstsc --init
// initialize tsconfig.json file- Create index.ts with:
import {BaseModifier} from 'popper.js';
tsc
// compile files
What is the expected behavior?
No errors should be reported.
What went wrong?
node_modules/popper.js/index.d.ts(38,5): error TS2411: Property 'shift' of type 'BaseModifier | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(39,5): error TS2411: Property 'offset' of type '(BaseModifier & { offset?: string | number | undefined; }) | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(42,5): error TS2411: Property 'preventOverflow' of type '(BaseModifier & { priority?: Position[] | undefined; padding?: number | undefined; boundariesElem...' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(47,5): error TS2411: Property 'keepTogether' of type 'BaseModifier | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(48,5): error TS2411: Property 'arrow' of type '(BaseModifier & { element?: string | Element | undefined; }) | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(51,5): error TS2411: Property 'flip' of type '(BaseModifier & { behavior?: Position[] | "flip" | "clockwise" | "counterclockwise" | undefined; ...' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(56,5): error TS2411: Property 'inner' of type 'BaseModifier | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(57,5): error TS2411: Property 'hide' of type 'BaseModifier | undefined' is not assignable to string index type 'BaseModifier & Record<string, any>'.
node_modules/popper.js/index.d.ts(58,5): error TS2411: Property 'applyStyle' of type '(BaseModifier & { onLoad?: Function | undefined; gpuAcceleration?: boolean | undefined; }) | unde...' is not assignable to string index type 'BaseModifier & Record<string, any>'.
Any other comments?
Will open a PR to fix
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Package breaks TypeScript 2.4.2 project with broken .d.ts ...
Assuming latest TypeScript (2.4.2 atm) is globally installed ... Package breaks TypeScript 2.4.2 project with broken .d.ts validation #369.
Read more >Documentation - TypeScript 2.4
Dynamic import expressions are a new feature and part of ECMAScript that allows users to asynchronously request a module at any arbitrary point...
Read more >Serene (ASP.NET MVC - Obsolete) - Visual Studio Marketplace
Serenity is a ASP.NET MVC / TypeScript application platform which has been built on open source technologies. It aims to make development easier ......
Read more >Npm package installation error on other partition
I'm getting this error whenever I install a package from npm on another ... /user/Personal/Projects/react/my-app/node_modules/bufferutil npm ...
Read more >@types/gl-matrix 2.2.26-alpha on npm - Libraries.io
Test editing an existing package. You can edit the types directly in node_modules/@types/foo/index.d.ts to validate your changes, then bring the changes to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yay. I barely got to comment and you already released a new version! 👍
Tricky, as the previous DT typings didn’t account for this scenario either… Unfortunately I don’t think it’s possible to get both possibilities into a single type definition file, and
package.json
doesn’t allow multiple type definitions.Slightly stuck on what to do in this situation, will report back when I know more.