Skip to content

Commit

Permalink
fix: enable strict mode
Browse files Browse the repository at this point in the history
In this commit, we enable strict mode because it is required to generate correct type definition
(`.d.ts`) files. These files differ depending on whether strict mode is enabled or disabled.
Enabling strict mode allows `null|undefined` values to be provided by the parent component
(e.g., `[tp]="null"`, which should be allowed), but the compiler removes `null|undefined`
values from the binding.

We also had to patch the `@popperjs/core` types due to a mistake in their definitions.
This patch was necessary for successful compilation
  • Loading branch information
arturovt committed Nov 17, 2024
1 parent 4012103 commit 0ad32a1
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 98 deletions.
265 changes: 264 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"scripts": {
"postinstall": "patch-package",
"ng": "ng",
"start-test": "start-server-and-test",
"deploy": "ng deploy --base-href=https://ngneat.github.io/helipopper/",
Expand Down Expand Up @@ -75,6 +76,7 @@
"karma-jasmine-html-reporter": "^1.5.0",
"lint-staged": "^9.2.0",
"ng-packagr": "^18.0.0",
"patch-package": "8.0.0",
"prettier": "2.8.8",
"serve": "^11.3.2",
"standard-version": "^8.0.2",
Expand Down
13 changes: 13 additions & 0 deletions patches/tippy.js++@popperjs+core+2.10.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/tippy.js/node_modules/@popperjs/core/lib/types.d.ts b/node_modules/tippy.js/node_modules/@popperjs/core/lib/types.d.ts
index 11f9219..f971927 100644
--- a/node_modules/tippy.js/node_modules/@popperjs/core/lib/types.d.ts
+++ b/node_modules/tippy.js/node_modules/@popperjs/core/lib/types.d.ts
@@ -114,7 +114,7 @@ export declare type ModifierArguments<Options extends Obj> = {
options: Partial<Options>;
name: string;
};
-export declare type Modifier<Name, Options> = {
+export declare type Modifier<Name, Options extends object> = {
name: Name;
enabled: boolean;
phase: ModifierPhases;
14 changes: 7 additions & 7 deletions projects/ngneat/helipopper/src/lib/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { TippyConfig } from './tippy.types';
import type { TippyProps } from './tippy.types';

type Variation = TippyConfig['variations'][0];
type Variation = Partial<TippyProps>;

export const tooltipVariation: Variation = {
theme: null,
theme: undefined,
arrow: false,
animation: 'scale',
trigger: 'mouseenter',
offset: [0, 5]
offset: [0, 5],
};

export const popperVariation: Variation = {
theme: 'light',
arrow: true,
offset: [0, 10],
animation: null,
animation: undefined,
trigger: 'click',
interactive: true
interactive: true,
};

export function withContextMenuVariation(baseVariation: Variation): Variation {
Expand All @@ -25,6 +25,6 @@ export function withContextMenuVariation(baseVariation: Variation): Variation {
placement: 'right-start',
trigger: 'manual',
arrow: false,
offset: [0, 0]
offset: [0, 0],
};
}
Loading

0 comments on commit 0ad32a1

Please sign in to comment.