@@ -35,7 +35,7 @@ tsTest("Member types can be retrieved", t => {
35
35
t . truthy ( isAssignableToType ( { kind : "NUMBER" } , toSimpleType ( type , checker ) ) ) ;
36
36
} ) ;
37
37
38
- tsTest ( "Property declaration member types are specialized" , t => {
38
+ tsTest ( "Property declaration member types are specialized (classes) " , t => {
39
39
const {
40
40
results : [ result ] ,
41
41
checker
@@ -70,6 +70,44 @@ tsTest("Property declaration member types are specialized", t => {
70
70
t . truthy ( isAssignableToType ( optional ( { kind : "BOOLEAN" } ) , toSimpleType ( booleanElementPropType , checker ) ) ) ;
71
71
} ) ;
72
72
73
+ tsTest ( "Property declaration member types are specialized (mixins)" , t => {
74
+ const {
75
+ results : [ result ] ,
76
+ checker
77
+ } = analyzeTextWithCurrentTsModule ( [
78
+ {
79
+ fileName : "main.ts" ,
80
+ text : `
81
+ const SomeMixin = <T, C>(Base: C) => {
82
+ class Mixin extends Base {
83
+ prop?: T;
84
+ }
85
+ return Mixin;
86
+ }
87
+
88
+ class NumberPropElement extends SomeMixin<number>(HTMLElement) {}
89
+
90
+ class BooleanPropElement extends SomeMixin<boolean>(HTMLElement) {}
91
+
92
+ declare global {
93
+ interface HTMLElementTagNameMap {
94
+ "number-prop-element": NumberPropElement;
95
+ "boolean-prop-element": BooleanPropElement;
96
+ }
97
+ }
98
+ `
99
+ }
100
+ ] ) ;
101
+
102
+ const numberElementDecl = result . componentDefinitions . find ( x => x . tagName === "number-prop-element" ) ! . declaration ! ;
103
+ const numberElementPropType = getComponentProp ( numberElementDecl . members , "prop" ) ! . type ! ( numberElementDecl ) ;
104
+ t . truthy ( isAssignableToType ( optional ( { kind : "NUMBER" } ) , toSimpleType ( numberElementPropType , checker ) ) ) ;
105
+
106
+ const booleanElementDecl = result . componentDefinitions . find ( x => x . tagName === "boolean-prop-element" ) ! . declaration ! ;
107
+ const booleanElementPropType = getComponentProp ( booleanElementDecl . members , "prop" ) ! . type ! ( booleanElementDecl ) ;
108
+ t . truthy ( isAssignableToType ( optional ( { kind : "BOOLEAN" } ) , toSimpleType ( booleanElementPropType , checker ) ) ) ;
109
+ } ) ;
110
+
73
111
tsTest ( "Getter member types are specialized" , t => {
74
112
const {
75
113
results : [ result ] ,
0 commit comments