@typespec/emitter-framework 0.7.0-dev.3 → 0.7.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -74,16 +74,16 @@ function getExtendsType($, type) {
|
|
|
74
74
|
extending.push(getRefkey(type.baseModel));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
77
|
+
const indexType = $.model.getIndexType(type);
|
|
78
|
+
if (indexType) {
|
|
79
79
|
// When extending a record we need to override the element type to be unknown to avoid type errors
|
|
80
|
-
if ($.record.is(
|
|
80
|
+
if ($.record.is(indexType)) {
|
|
81
81
|
// Here we are in the additional properties land.
|
|
82
82
|
// Instead of extending we need to create an envelope property
|
|
83
83
|
// do nothing here.
|
|
84
84
|
} else {
|
|
85
85
|
extending.push(_$createComponent(TypeExpression, {
|
|
86
|
-
type:
|
|
86
|
+
type: indexType
|
|
87
87
|
}));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -170,7 +170,7 @@ export function ModelTransformExpression(props) {
|
|
|
170
170
|
target: props.type
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
-
if ($.model.
|
|
173
|
+
if ($.model.getIndexType(props.type)) {
|
|
174
174
|
reportTypescriptDiagnostic($.program, {
|
|
175
175
|
code: "typescript-spread-model-transformation-nyi",
|
|
176
176
|
target: props.type
|
package/package.json
CHANGED
|
@@ -96,15 +96,15 @@ function getExtendsType($: Typekit, type: Model | Interface): Children | undefin
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
99
|
+
const indexType = $.model.getIndexType(type);
|
|
100
|
+
if (indexType) {
|
|
101
101
|
// When extending a record we need to override the element type to be unknown to avoid type errors
|
|
102
|
-
if ($.record.is(
|
|
102
|
+
if ($.record.is(indexType)) {
|
|
103
103
|
// Here we are in the additional properties land.
|
|
104
104
|
// Instead of extending we need to create an envelope property
|
|
105
105
|
// do nothing here.
|
|
106
106
|
} else {
|
|
107
|
-
extending.push(<TypeExpression type={
|
|
107
|
+
extending.push(<TypeExpression type={indexType} />);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -198,7 +198,7 @@ export function ModelTransformExpression(props: ModelTransformExpressionProps) {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
if ($.model.
|
|
201
|
+
if ($.model.getIndexType(props.type)) {
|
|
202
202
|
reportTypescriptDiagnostic($.program, {
|
|
203
203
|
code: "typescript-spread-model-transformation-nyi",
|
|
204
204
|
target: props.type,
|