Compare commits

...

2 Commits

Author SHA1 Message Date
Oliver Zell
33b58f84b8 fix common modules 2022-03-09 19:49:55 +01:00
Oliver Zell
4b4159df0d enable strictNullChecks 2022-03-09 19:36:33 +01:00
4 changed files with 8 additions and 9 deletions

View File

@ -44,8 +44,8 @@ export default class Mat33 {
constructor(a?: Vec3, b?: Vec3, c?: Vec3) {
if (typeof a === 'object' && a !== null) {
this.ex = Vec3.clone(a);
this.ey = Vec3.clone(b);
this.ez = Vec3.clone(c);
this.ey = Vec3.clone(b!);
this.ez = Vec3.clone(c!);
} else {
this.ex = Vec3.zero();
this.ey = Vec3.zero();

View File

@ -139,7 +139,7 @@ export default class Transform {
static mul(a, b) {
if (Array.isArray(b)) {
_ASSERT && Transform.assert(a);
const arr = [];
const arr: Vec2[] | Transform[] = [];
for (let i = 0; i < b.length; i++) {
arr[i] = Transform.mul(a, b[i]);
}
@ -158,7 +158,7 @@ export default class Transform {
// tslint:disable-next-line:typedef
static mulAll(a: Transform, b) {
_ASSERT && Transform.assert(a);
const arr = [];
const arr: Vec2[] | Transform[] = [];
for (let i = 0; i < b.length; i++) {
arr[i] = Transform.mul(a, b[i]);
}

View File

@ -183,7 +183,7 @@ export default class Vec2 {
* @deprecated Use setCombine or setMul
*/
wSet(a: number, v: Vec2, b?: number, w?: Vec2): Vec2 {
if (typeof b !== 'undefined' || typeof w !== 'undefined') {
if (typeof b !== 'undefined' && typeof w !== 'undefined') {
return this.setCombine(a, v, b, w);
} else {
return this.setMul(a, v);
@ -235,7 +235,7 @@ export default class Vec2 {
* @deprecated Use addCombine or addMul
*/
wAdd(a: number, v: Vec2, b?: number, w?: Vec2): Vec2 {
if (typeof b !== 'undefined' || typeof w !== 'undefined') {
if (typeof b !== 'undefined' && typeof w !== 'undefined') {
return this.addCombine(a, v, b, w);
} else {
return this.addMul(a, v);
@ -275,7 +275,7 @@ export default class Vec2 {
* @deprecated Use subCombine or subMul
*/
wSub(a: number, v: Vec2, b?: number, w?: Vec2): Vec2 {
if (typeof b !== 'undefined' || typeof w !== 'undefined') {
if (typeof b !== 'undefined' && typeof w !== 'undefined') {
return this.subCombine(a, v, b, w);
} else {
return this.subMul(a, v);

View File

@ -6,8 +6,7 @@
},
"compilerOptions": {
"module": "commonjs",
// "strictNullChecks": true,
// "noImplicitAny": true,
"strictNullChecks": true,
"lib": ["ES2015", "DOM"],
"stripInternal": true,
"target": "ES5"