Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/fix(ts/api): Allow top-level type definition for slot scopes (fix: #11090, #11500) #11591

Conversation

yusufkandemir
Copy link
Member

@yusufkandemir yusufkandemir commented Dec 8, 2021

What kind of change does this PR introduce?

  • Bugfix
  • Feature

Does this PR introduce a breaking change?

  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)

Other information:
Fixes #11090
Fixes #11500

dist/types/index.d.ts diff:

@@ -6404,21 +6404,44 @@
 
 export interface QOptionGroupSlots {
   /**
    * Generic slot for all labels
-   * @param scope
+   * @param scope The corresponding option entry from the 'options' prop
    */
   label: (scope: {
     /**
-     * The corresponding option entry from the 'options' prop
+     * Label to display along the component
      */
-    opt: LooseDictionary;
+    label: string;
+    /**
+     * Value of the option that will be used by the component model
+     */
+    value: any;
+    /**
+     * If true, the option will be disabled
+     */
+    disable?: boolean;
+    [index: string]: any;
   }) => VNode[];
   /**
    * Slot to define the specific label for the option at '[name]' where name is a 0-based index; Overrides the generic 'label' slot if used
-   * @param scope
+   * @param scope The corresponding option entry from the 'options' prop
    */
-  [key: `label-${string}`]: (scope: { [index: string]: any }) => VNode[];
+  [key: `label-${string}`]: (scope: {
+    /**
+     * Label to display along the component
+     */
+    label: string;
+    /**
+     * Value of the option that will be used by the component model
+     */
+    value: any;
+    /**
+     * If true, the option will be disabled
+     */
+    disable?: boolean;
+    [index: string]: any;
+  }) => VNode[];
 }
 
 export interface QOptionGroup
   extends ComponentPublicInstance<QOptionGroupProps> {}
@@ -12690,14 +12713,16 @@
 
 export interface QUploaderSlots {
   /**
    * Slot for custom header; Scope is the QUploader instance itself
+   * @param scope QUploader instance
    */
-  header: () => VNode[];
+  header: (scope: QUploader) => VNode[];
   /**
    * Slot for custom list; Scope is the QUploader instance itself
+   * @param scope QUploader instance
    */
-  list: () => VNode[];
+  list: (scope: QUploader) => VNode[];
 }

@rstoenescu rstoenescu merged commit 97f2a09 into quasarframework:dev Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QOptionGroup label slot types are wrong Scoped slot prarams types for QUploader
2 participants