diff --git a/.gitignore b/.gitignore index bd1c201e..589c761d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ bundle.js target lib *.tar.gz +types diff --git a/package.json b/package.json index 8a91f611..b39b0c2d 100644 --- a/package.json +++ b/package.json @@ -42,10 +42,10 @@ "regenerator-runtime": "^0.13.7", "rollup-plugin-cleanup": "^3.1.1", "serve-static": "^1.13.2", + "typescript": "^4.2.3", "xxhashjs": "^0.2.2" }, "dependencies": { - "rollup": "^2.26.4", "@rollup/plugin-commonjs": "^15.0.0", "@rollup/plugin-node-resolve": "^9.0.0", "aes-js": "^3.1.2", @@ -54,6 +54,7 @@ "bs58": "^4.0.1", "es6-promise": "https://github.com/bwindels/es6-promise.git#bwindels/expose-flush", "olm": "https://packages.matrix.org/npm/olm/olm-3.1.4.tgz", + "rollup": "^2.26.4", "text-encoding": "^0.7.0" } } diff --git a/src/matrix/room/members/MemberList.js b/src/matrix/room/members/MemberList.js index 734887fd..9241a592 100644 --- a/src/matrix/room/members/MemberList.js +++ b/src/matrix/room/members/MemberList.js @@ -18,11 +18,23 @@ import {ObservableMap} from "../../../observable/map/ObservableMap.js"; export class MemberList { constructor({members, closeCallback}) { + /** + * @private + * @type {ObservableMap} + */ this._members = new ObservableMap(); for (const member of members) { this._members.add(member.userId, member); } + /** + * @private + * @type {Function} + */ this._closeCallback = closeCallback; + /** + * @private + * @type {Number} + */ this._retentionCount = 1; } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..2fb78fa9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "es2020", + "lib": ["es2020", "dom"], + "allowJs": true, + "checkJs": true, + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "types" + }, + "files": ["src/main.js", "src/platform/web/Platform.js"], + "disabledCompilerOptions": { + "noEmit": true, + "strict": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true + } +} diff --git a/yarn.lock b/yarn.lock index fc6d75d8..19c2b66d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1014,12 +1014,7 @@ builtin-modules@^3.1.0: resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== -caniuse-lite@^1.0.30001111: - version "1.0.30001187" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001187.tgz" - integrity sha512-w7/EP1JRZ9552CyrThUnay2RkZ1DXxKe/Q2swTC4+LElLh9RRYrL1Z+27LlakB8kzY0fSmHw9mc7XYDUKAKWMA== - -caniuse-lite@^1.0.30001135, caniuse-lite@^1.0.30001137: +caniuse-lite@^1.0.30001111, caniuse-lite@^1.0.30001135, caniuse-lite@^1.0.30001137: version "1.0.30001187" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001187.tgz" integrity sha512-w7/EP1JRZ9552CyrThUnay2RkZ1DXxKe/Q2swTC4+LElLh9RRYrL1Z+27LlakB8kzY0fSmHw9mc7XYDUKAKWMA== @@ -1980,6 +1975,11 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== +typescript@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" + integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== + unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"