!487 fix function isSendableTypeNode with warning
Some checks failed
CI / build (10.x) (push) Failing after 0s
CI / build (12.x) (push) Failing after 0s
CI / build (14.x) (push) Failing after 0s
Code scanning - action / CodeQL-Build (push) Failing after 0s
Update package-lock.json / build (push) Failing after 1s
Publish Nightly / build (push) Failing after 1s
Twoslash Code Sample Repros / build (push) Failing after 1s

Merge pull request !487 from yangrui/0917_warning
This commit is contained in:
openharmony_ci 2024-09-18 08:24:40 +00:00 committed by Gitee
commit e63923a05f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 239 additions and 58 deletions

View File

@ -194983,7 +194983,8 @@ var ts;
FaultID[FaultID["SendableClosureExport"] = 108] = "SendableClosureExport";
FaultID[FaultID["SharedModuleExportsWarning"] = 109] = "SharedModuleExportsWarning";
FaultID[FaultID["SendableBetaCompatible"] = 110] = "SendableBetaCompatible";
FaultID[FaultID["LAST_ID"] = 111] = "LAST_ID";
FaultID[FaultID["SendablePropTypeWarning"] = 111] = "SendablePropTypeWarning";
FaultID[FaultID["LAST_ID"] = 112] = "LAST_ID";
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
var FaultAttributes = /** @class */ (function () {
function FaultAttributes(cookBookRef, migratable, severity) {
@ -195108,6 +195109,7 @@ var ts;
Problems.faultsAttrs[FaultID.SendableClosureExport] = new FaultAttributes(181, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182);
Problems.faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING);
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
})(ts || (ts = {}));
@ -196926,13 +196928,6 @@ var ts;
if (sym && sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */) {
var typeDecl = getDeclaration(sym);
if (typeDecl && ts.isTypeAliasDeclaration(typeDecl)) {
var typeArgs = typeNode.typeArguments;
if (typeArgs &&
!typeArgs.every(function (typeArg) {
return isSendableTypeNode(typeArg);
})) {
return false;
}
return isSendableTypeNode(typeDecl.type, isShared);
}
}
@ -198291,6 +198286,39 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.checkTypeAliasInSendableScope = function (node) {
var _this = this;
if (!node.type) {
return;
}
var typeNode = ArkTSLinter_1_1.Utils.unwrapParenthesizedTypeNode(node.type);
var needWarning = (ts.isUnionTypeNode(typeNode) && typeNode.types.some(function (elemType) { return _this.isNoneSendableTypeAlias(elemType); })) ||
(ts.isTypeReferenceNode(typeNode) && this.isNoneSendableTypeAlias(typeNode));
if (needWarning) {
this.incrementCounters(node.type, FaultID.SendablePropTypeWarning);
}
};
TypeScriptLinter.prototype.isNoneSendableTypeAlias = function (typeNode) {
if (!ts.isTypeReferenceNode(typeNode)) {
return false;
}
var sym = ArkTSLinter_1_1.Utils.trueSymbolAtLocation(typeNode.typeName);
if (!sym || !(sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */)) {
return false;
}
var typeDecl = ArkTSLinter_1_1.Utils.getDeclaration(sym);
if (!typeDecl || !ts.isTypeAliasDeclaration(typeDecl)) {
return false;
}
var typeArgs = typeNode.typeArguments;
if (typeArgs && !typeArgs.every(function (typeArg) { return ArkTSLinter_1_1.Utils.isSendableTypeNode(typeArg); })) {
return true;
}
return false;
};
TypeScriptLinter.prototype.handlePropertyAssignment = function (node) {
var propName = node.name;
@ -198345,6 +198373,9 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.filterOutDecoratorsDiagnostics = function (decorators, expectedDecorators, range, code, prop_type) {
// Filter out non-initializable property decorators from strict diagnostics.

View File

@ -13239,7 +13239,8 @@ declare namespace ts {
SendableClosureExport = 108,
SharedModuleExportsWarning = 109,
SendableBetaCompatible = 110,
LAST_ID = 111
SendablePropTypeWarning = 111,
LAST_ID = 112
}
class FaultAttributes {
cookBookRef: number;
@ -13574,6 +13575,8 @@ declare namespace ts {
private handlePropertyAccessExpression;
private handlePropertyDeclaration;
private handleSendableClassProperty;
private checkTypeAliasInSendableScope;
private isNoneSendableTypeAlias;
private handlePropertyAssignment;
private handlePropertySignature;
private handleSendableInterfaceProperty;

View File

@ -194728,7 +194728,8 @@ var ts;
FaultID[FaultID["SendableClosureExport"] = 108] = "SendableClosureExport";
FaultID[FaultID["SharedModuleExportsWarning"] = 109] = "SharedModuleExportsWarning";
FaultID[FaultID["SendableBetaCompatible"] = 110] = "SendableBetaCompatible";
FaultID[FaultID["LAST_ID"] = 111] = "LAST_ID";
FaultID[FaultID["SendablePropTypeWarning"] = 111] = "SendablePropTypeWarning";
FaultID[FaultID["LAST_ID"] = 112] = "LAST_ID";
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
var FaultAttributes = /** @class */ (function () {
function FaultAttributes(cookBookRef, migratable, severity) {
@ -194853,6 +194854,7 @@ var ts;
Problems.faultsAttrs[FaultID.SendableClosureExport] = new FaultAttributes(181, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182);
Problems.faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING);
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
})(ts || (ts = {}));
@ -196671,13 +196673,6 @@ var ts;
if (sym && sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */) {
var typeDecl = getDeclaration(sym);
if (typeDecl && ts.isTypeAliasDeclaration(typeDecl)) {
var typeArgs = typeNode.typeArguments;
if (typeArgs &&
!typeArgs.every(function (typeArg) {
return isSendableTypeNode(typeArg);
})) {
return false;
}
return isSendableTypeNode(typeDecl.type, isShared);
}
}
@ -198036,6 +198031,39 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.checkTypeAliasInSendableScope = function (node) {
var _this = this;
if (!node.type) {
return;
}
var typeNode = ArkTSLinter_1_1.Utils.unwrapParenthesizedTypeNode(node.type);
var needWarning = (ts.isUnionTypeNode(typeNode) && typeNode.types.some(function (elemType) { return _this.isNoneSendableTypeAlias(elemType); })) ||
(ts.isTypeReferenceNode(typeNode) && this.isNoneSendableTypeAlias(typeNode));
if (needWarning) {
this.incrementCounters(node.type, FaultID.SendablePropTypeWarning);
}
};
TypeScriptLinter.prototype.isNoneSendableTypeAlias = function (typeNode) {
if (!ts.isTypeReferenceNode(typeNode)) {
return false;
}
var sym = ArkTSLinter_1_1.Utils.trueSymbolAtLocation(typeNode.typeName);
if (!sym || !(sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */)) {
return false;
}
var typeDecl = ArkTSLinter_1_1.Utils.getDeclaration(sym);
if (!typeDecl || !ts.isTypeAliasDeclaration(typeDecl)) {
return false;
}
var typeArgs = typeNode.typeArguments;
if (typeArgs && !typeArgs.every(function (typeArg) { return ArkTSLinter_1_1.Utils.isSendableTypeNode(typeArg); })) {
return true;
}
return false;
};
TypeScriptLinter.prototype.handlePropertyAssignment = function (node) {
var propName = node.name;
@ -198090,6 +198118,9 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.filterOutDecoratorsDiagnostics = function (decorators, expectedDecorators, range, code, prop_type) {
// Filter out non-initializable property decorators from strict diagnostics.

5
lib/typescript.d.ts vendored
View File

@ -9293,7 +9293,8 @@ declare namespace ts {
SendableClosureExport = 108,
SharedModuleExportsWarning = 109,
SendableBetaCompatible = 110,
LAST_ID = 111
SendablePropTypeWarning = 111,
LAST_ID = 112
}
class FaultAttributes {
cookBookRef: number;
@ -9628,6 +9629,8 @@ declare namespace ts {
private handlePropertyAccessExpression;
private handlePropertyDeclaration;
private handleSendableClassProperty;
private checkTypeAliasInSendableScope;
private isNoneSendableTypeAlias;
private handlePropertyAssignment;
private handlePropertySignature;
private handleSendableInterfaceProperty;

View File

@ -183822,7 +183822,8 @@ var ts;
FaultID[FaultID["SendableClosureExport"] = 108] = "SendableClosureExport";
FaultID[FaultID["SharedModuleExportsWarning"] = 109] = "SharedModuleExportsWarning";
FaultID[FaultID["SendableBetaCompatible"] = 110] = "SendableBetaCompatible";
FaultID[FaultID["LAST_ID"] = 111] = "LAST_ID";
FaultID[FaultID["SendablePropTypeWarning"] = 111] = "SendablePropTypeWarning";
FaultID[FaultID["LAST_ID"] = 112] = "LAST_ID";
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
var FaultAttributes = /** @class */ (function () {
function FaultAttributes(cookBookRef, migratable, severity) {
@ -183947,6 +183948,7 @@ var ts;
Problems.faultsAttrs[FaultID.SendableClosureExport] = new FaultAttributes(181, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182);
Problems.faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING);
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
})(ts || (ts = {}));
@ -185765,13 +185767,6 @@ var ts;
if (sym && sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */) {
var typeDecl = getDeclaration(sym);
if (typeDecl && ts.isTypeAliasDeclaration(typeDecl)) {
var typeArgs = typeNode.typeArguments;
if (typeArgs &&
!typeArgs.every(function (typeArg) {
return isSendableTypeNode(typeArg);
})) {
return false;
}
return isSendableTypeNode(typeDecl.type, isShared);
}
}
@ -187130,6 +187125,39 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.checkTypeAliasInSendableScope = function (node) {
var _this = this;
if (!node.type) {
return;
}
var typeNode = ArkTSLinter_1_1.Utils.unwrapParenthesizedTypeNode(node.type);
var needWarning = (ts.isUnionTypeNode(typeNode) && typeNode.types.some(function (elemType) { return _this.isNoneSendableTypeAlias(elemType); })) ||
(ts.isTypeReferenceNode(typeNode) && this.isNoneSendableTypeAlias(typeNode));
if (needWarning) {
this.incrementCounters(node.type, FaultID.SendablePropTypeWarning);
}
};
TypeScriptLinter.prototype.isNoneSendableTypeAlias = function (typeNode) {
if (!ts.isTypeReferenceNode(typeNode)) {
return false;
}
var sym = ArkTSLinter_1_1.Utils.trueSymbolAtLocation(typeNode.typeName);
if (!sym || !(sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */)) {
return false;
}
var typeDecl = ArkTSLinter_1_1.Utils.getDeclaration(sym);
if (!typeDecl || !ts.isTypeAliasDeclaration(typeDecl)) {
return false;
}
var typeArgs = typeNode.typeArguments;
if (typeArgs && !typeArgs.every(function (typeArg) { return ArkTSLinter_1_1.Utils.isSendableTypeNode(typeArg); })) {
return true;
}
return false;
};
TypeScriptLinter.prototype.handlePropertyAssignment = function (node) {
var propName = node.name;
@ -187184,6 +187212,9 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.filterOutDecoratorsDiagnostics = function (decorators, expectedDecorators, range, code, prop_type) {
// Filter out non-initializable property decorators from strict diagnostics.

View File

@ -9293,7 +9293,8 @@ declare namespace ts {
SendableClosureExport = 108,
SharedModuleExportsWarning = 109,
SendableBetaCompatible = 110,
LAST_ID = 111
SendablePropTypeWarning = 111,
LAST_ID = 112
}
class FaultAttributes {
cookBookRef: number;
@ -9628,6 +9629,8 @@ declare namespace ts {
private handlePropertyAccessExpression;
private handlePropertyDeclaration;
private handleSendableClassProperty;
private checkTypeAliasInSendableScope;
private isNoneSendableTypeAlias;
private handlePropertyAssignment;
private handlePropertySignature;
private handleSendableInterfaceProperty;

View File

@ -183822,7 +183822,8 @@ var ts;
FaultID[FaultID["SendableClosureExport"] = 108] = "SendableClosureExport";
FaultID[FaultID["SharedModuleExportsWarning"] = 109] = "SharedModuleExportsWarning";
FaultID[FaultID["SendableBetaCompatible"] = 110] = "SendableBetaCompatible";
FaultID[FaultID["LAST_ID"] = 111] = "LAST_ID";
FaultID[FaultID["SendablePropTypeWarning"] = 111] = "SendablePropTypeWarning";
FaultID[FaultID["LAST_ID"] = 112] = "LAST_ID";
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
var FaultAttributes = /** @class */ (function () {
function FaultAttributes(cookBookRef, migratable, severity) {
@ -183947,6 +183948,7 @@ var ts;
Problems.faultsAttrs[FaultID.SendableClosureExport] = new FaultAttributes(181, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING);
Problems.faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182);
Problems.faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING);
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
})(ts || (ts = {}));
@ -185765,13 +185767,6 @@ var ts;
if (sym && sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */) {
var typeDecl = getDeclaration(sym);
if (typeDecl && ts.isTypeAliasDeclaration(typeDecl)) {
var typeArgs = typeNode.typeArguments;
if (typeArgs &&
!typeArgs.every(function (typeArg) {
return isSendableTypeNode(typeArg);
})) {
return false;
}
return isSendableTypeNode(typeDecl.type, isShared);
}
}
@ -187130,6 +187125,39 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.checkTypeAliasInSendableScope = function (node) {
var _this = this;
if (!node.type) {
return;
}
var typeNode = ArkTSLinter_1_1.Utils.unwrapParenthesizedTypeNode(node.type);
var needWarning = (ts.isUnionTypeNode(typeNode) && typeNode.types.some(function (elemType) { return _this.isNoneSendableTypeAlias(elemType); })) ||
(ts.isTypeReferenceNode(typeNode) && this.isNoneSendableTypeAlias(typeNode));
if (needWarning) {
this.incrementCounters(node.type, FaultID.SendablePropTypeWarning);
}
};
TypeScriptLinter.prototype.isNoneSendableTypeAlias = function (typeNode) {
if (!ts.isTypeReferenceNode(typeNode)) {
return false;
}
var sym = ArkTSLinter_1_1.Utils.trueSymbolAtLocation(typeNode.typeName);
if (!sym || !(sym.getFlags() & 524288 /* ts.SymbolFlags.TypeAlias */)) {
return false;
}
var typeDecl = ArkTSLinter_1_1.Utils.getDeclaration(sym);
if (!typeDecl || !ts.isTypeAliasDeclaration(typeDecl)) {
return false;
}
var typeArgs = typeNode.typeArguments;
if (typeArgs && !typeArgs.every(function (typeArg) { return ArkTSLinter_1_1.Utils.isSendableTypeNode(typeArg); })) {
return true;
}
return false;
};
TypeScriptLinter.prototype.handlePropertyAssignment = function (node) {
var propName = node.name;
@ -187184,6 +187212,9 @@ var ts;
if (!ArkTSLinter_1_1.Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
}
else {
this.checkTypeAliasInSendableScope(node);
}
};
TypeScriptLinter.prototype.filterOutDecoratorsDiagnostics = function (decorators, expectedDecorators, range, code, prop_type) {
// Filter out non-initializable property decorators from strict diagnostics.

View File

@ -46,7 +46,7 @@ export enum FaultID {
SendableExplicitFieldType,
SendableFunctionImportedVariables, SendableFunctionDecorator, SendableTypeAliasDecorator, SendableTypeAliasDeclaration,
SendableFunctionAssignment, SendableFunctionOverloadDecorator, SendableFunctionProperty, SendableFunctionAsExpr,
SendableDecoratorLimited, SendableClosureExport, SharedModuleExportsWarning, SendableBetaCompatible,
SendableDecoratorLimited, SendableClosureExport, SharedModuleExportsWarning, SendableBetaCompatible, SendablePropTypeWarning,
LAST_ID, // this should always be last enum
}
@ -171,6 +171,7 @@ faultsAttrs[FaultID.SendableDecoratorLimited] = new FaultAttributes(180);
faultsAttrs[FaultID.SendableClosureExport] = new FaultAttributes(181, false, ProblemSeverity.WARNING);
faultsAttrs[FaultID.SharedModuleExportsWarning] = new FaultAttributes(163, false, ProblemSeverity.WARNING);
faultsAttrs[FaultID.SendableBetaCompatible] = new FaultAttributes(182);
faultsAttrs[FaultID.SendablePropTypeWarning] = new FaultAttributes(154, false, ProblemSeverity.WARNING);
}
}
}

View File

@ -767,9 +767,49 @@ export class TypeScriptLinter {
});
if (!Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
} else {
this.checkTypeAliasInSendableScope(node);
}
}
private checkTypeAliasInSendableScope(node: ts.PropertyDeclaration | ts.PropertySignature): void {
if (!node.type) {
return;
}
const typeNode = Utils.unwrapParenthesizedTypeNode(node.type);
const needWarning =
(ts.isUnionTypeNode(typeNode) && typeNode.types.some((elemType) => this.isNoneSendableTypeAlias(elemType))) ||
(ts.isTypeReferenceNode(typeNode) && this.isNoneSendableTypeAlias(typeNode));
if (needWarning) {
this.incrementCounters(node.type, FaultID.SendablePropTypeWarning);
}
}
private isNoneSendableTypeAlias(typeNode: TypeNode): boolean {
if (!ts.isTypeReferenceNode(typeNode)) {
return false;
}
const sym = Utils.trueSymbolAtLocation(typeNode.typeName);
if (!sym || !(sym.getFlags() & ts.SymbolFlags.TypeAlias)) {
return false;
}
const typeDecl = Utils.getDeclaration(sym);
if (!typeDecl || !ts.isTypeAliasDeclaration(typeDecl)) {
return false;
}
const typeArgs = typeNode.typeArguments;
if (typeArgs && !typeArgs.every((typeArg) => Utils.isSendableTypeNode(typeArg))) {
return true;
}
return false;
}
private handlePropertyAssignment(node: ts.PropertyAssignment) {
const propName = node.name;
if (!(!!propName && ts.isNumericLiteral(propName))) {
@ -826,6 +866,8 @@ export class TypeScriptLinter {
}
if (!Utils.isSendableTypeNode(typeNode)) {
this.incrementCounters(node, FaultID.SendablePropType);
} else {
this.checkTypeAliasInSendableScope(node);
}
}

View File

@ -1971,15 +1971,6 @@ export function isSendableTypeNode(typeNode: ts.TypeNode, isShared: boolean = fa
if (sym && sym.getFlags() & ts.SymbolFlags.TypeAlias) {
const typeDecl = getDeclaration(sym);
if (typeDecl && ts.isTypeAliasDeclaration(typeDecl)) {
const typeArgs = (typeNode as ts.TypeReferenceNode).typeArguments;
if (
typeArgs &&
!typeArgs.every((typeArg) => {
return isSendableTypeNode(typeArg);
})
) {
return false;
}
return isSendableTypeNode(typeDecl.type, isShared);
}
}

View File

@ -334,7 +334,7 @@ function run(){
}
}
ignoreList = ignoreList.concat(ignoreCaseConfigList).map(x => path.normalize(x))
ignoreList = ignoreList.concat(ignoreCaseConfigList).map(x => path.normalize(x));
let filePathStats = fs.lstatSync(filePath)
if(!filePathStats.isDirectory()){

View File

@ -20,15 +20,16 @@ declare type Nullable<T> = T | undefined;
type MyType<T> = B<T> | undefined;
class C {
c: number;
public c: number;
}
@Sendable
class D {
a: Nullable<A>; // NOT OK
b: Nullable<C> = new C(); // NOT OK
c: Nullable<number> = 1; // OK
d: MyType<number>; // NOT OK
public a: Nullable<A>; // NOT OK
public b: Nullable<C> = new C(); // NOT OK
public c: Nullable<number> = 1; // OK
public d: MyType<number>; // NOT OK
public e: Nullable<A> || number; // NOT OK
}
let d = new D();

View File

@ -4,7 +4,7 @@
"messageText": "Property 'c' has no initializer and is not definitely assigned in the constructor.",
"expectLineAndCharacter": {
"line": 23,
"character": 3
"character": 10
}
},
{
@ -20,28 +20,28 @@
"messageText": "Property 'c' has no initializer and is not definitely assigned in the constructor.",
"expectLineAndCharacter": {
"line": 23,
"character": 3
"character": 10
}
},
{
"messageText": "Only imported variables can be captured by \"Sendable\" class (arkts-sendable-imported-variables)",
"expectLineAndCharacter": {
"line": 29,
"character": 24
"character": 31
}
},
{
"messageText": "Properties in \"Sendable\" classes and interfaces must have a Sendable data type (arkts-sendable-prop-types)",
"expectLineAndCharacter": {
"line": 28,
"character": 3
"character": 13
}
},
{
"messageText": "Properties in \"Sendable\" classes and interfaces must have a Sendable data type (arkts-sendable-prop-types)",
"expectLineAndCharacter": {
"line": 29,
"character": 3
"character": 13
}
},
{
@ -50,6 +50,13 @@
"line": 31,
"character": 3
}
},
{
"messageText": "Properties in \"Sendable\" classes and interfaces must have a Sendable data type (arkts-sendable-prop-types)",
"expectLineAndCharacter": {
"line": 32,
"character": 13
}
}
]
}

View File

@ -13239,7 +13239,8 @@ declare namespace ts {
SendableClosureExport = 108,
SharedModuleExportsWarning = 109,
SendableBetaCompatible = 110,
LAST_ID = 111
SendablePropTypeWarning = 111,
LAST_ID = 112
}
class FaultAttributes {
cookBookRef: number;
@ -13574,6 +13575,8 @@ declare namespace ts {
private handlePropertyAccessExpression;
private handlePropertyDeclaration;
private handleSendableClassProperty;
private checkTypeAliasInSendableScope;
private isNoneSendableTypeAlias;
private handlePropertyAssignment;
private handlePropertySignature;
private handleSendableInterfaceProperty;

View File

@ -9293,7 +9293,8 @@ declare namespace ts {
SendableClosureExport = 108,
SharedModuleExportsWarning = 109,
SendableBetaCompatible = 110,
LAST_ID = 111
SendablePropTypeWarning = 111,
LAST_ID = 112
}
class FaultAttributes {
cookBookRef: number;
@ -9628,6 +9629,8 @@ declare namespace ts {
private handlePropertyAccessExpression;
private handlePropertyDeclaration;
private handleSendableClassProperty;
private checkTypeAliasInSendableScope;
private isNoneSendableTypeAlias;
private handlePropertyAssignment;
private handlePropertySignature;
private handleSendableInterfaceProperty;