profile
viewpoint
Mateusz Burzyński Andarist @statelyai Wrocław, Poland

alexreardon/bind-event-listener 104

A utility to make binding and (especially) unbinding DOM events easier

Andarist/babel-plugin-annotate-pure-calls 92

This plugins helps with annotating top level functions calls with #__PURE__ comment.

aaronshaf/react-callbag-subject 9

Asynchronous pipelines in React using callbags

aaronshaf/callbag-gamepads 6

Callbag source for connected gamepad inputs

aaronshaf/callbag-animation-frames 5

Callbag listenable source sending DOMHighResTimeStamp at display refresh rate

Andarist/are-hook-inputs-equal 4

A comparator function for previous and current React hook inputs.

aaronshaf/callbag-keyboard 3

Callbag source for the keyboard

aaronshaf/callbag-flatten-iter 2

Callbag operator that flattens iterables

Andarist/arethetypeswrong.github.io 1

Tool for analyzing TypeScript types of npm packages

issue commentmicrosoft/TypeScript

Support for reverse mapped type with intersection constraint

It's also worth noting here that there is a strong relation between this and the other PR that - sort of - makes a very similar thing possible: https://github.com/microsoft/TypeScript/pull/52972

I think that both can co-exist because one is about non-homomorphic mapped types and the other one is about homomorphic mapped types.

jfet97

comment created time in 10 hours

delete branch Andarist/TypeScript

delete branch : fix/inferred-class-fields-in-js-not-through-super

delete time in 21 hours

PR opened microsoft/TypeScript

Rename `isClassFieldAndNotAutoAccessor` to `isClassInstanceProperty`

cc @DanielRosenwasser , the util is internal so it shouldn't matter when this lands

+3 -3

0 comment

2 changed files

pr created time in 21 hours

create barnchAndarist/TypeScript

branch : rename-helper

created branch time in 21 hours

Pull request review commentEffect-TS/effect

hotfix exports types condition for consumers with `NodeNext` module resolution

 modules       module: `./${module}/dist/effect-${module}.esm.js`,       import: `./${module}/dist/effect-${module}.cjs.mjs`,       default: `./${module}/dist/effect-${module}.cjs.js`,+      types: `./dist/declarations/src/${module}.d.ts`,

I'd expect that this relies on the "fallback condition" thing or however it's called but this doesn't list it as a problem: https://arethetypeswrong.github.io/?p=effect%402.0.0-next.39 . Note that this "fallback" thing is actually a bug in TS - for the time being it continues to work with it but it shouldn't.

The issue here might be a different one. it's hard to tell on the spot without analyzing further - it's not worth spending time on it though ;p Rules-wise - it should be on the top (or at least it's usually advised for it to be at the top). If it works right now... maybe it is not worth changing it. 🤷‍♂️ Personally I'd probably change it though.

fubhy

comment created time in a day

PullRequestReviewEvent

push eventAndarist/TypeScript

Mateusz Burzyński

commit sha 8cd9111212017d2a0e9b7afd4d24b2fbe935edea

ditch the cast altogether

view details

push time in a day

push eventAndarist/TypeScript

Mateusz Burzyński

commit sha c0f986d124dc7fa3ae011573e185fc38b0109276

Make the cast more accurate

view details

push time in a day

Pull request review commentmicrosoft/TypeScript

Fixed na issue with evaluator using binding element initializers as const values

 export function createTypeChecker(host: TypeCheckerHost): TypeChecker {                         }
                         if (isConstantVariable(symbol)) {
                             const declaration = symbol.valueDeclaration as VariableDeclaration | undefined;
-                            if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
+                            if (declaration?.kind === SyntaxKind.VariableDeclaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {

I'll also note that this feels weird because declaration is VariableDeclaration which must have kind === SyntaxKind.VariableDeclaration.

Good catch! I didn't notice it. It is VariableDeclaration just because of the cast - so I'll make that cast more accurate in a second :)

Andarist

comment created time in a day

PullRequestReviewEvent

Pull request review commentEffect-TS/effect

hotfix exports types condition for consumers with `NodeNext` module resolution

 modules       module: `./${module}/dist/effect-${module}.esm.js`,       import: `./${module}/dist/effect-${module}.cjs.mjs`,       default: `./${module}/dist/effect-${module}.cjs.js`,+      types: `./dist/declarations/src/${module}.d.ts`,

all exports keys are order-sensitive so this should be the first one here

fubhy

comment created time in a day

PullRequestReviewEvent

push eventAndarist/TypeScript

Mateusz Burzyński

commit sha 5d29c23025ede0c2cd8054f743c881e11f4f253a

remove redundant passthrough function

view details

push time in a day

Pull request review commentmicrosoft/TypeScript

Fixed na issue with evaluator using binding element initializers as const values

 export function createTypeChecker(host: TypeCheckerHost): TypeChecker {                         }
                         if (isConstantVariable(symbol)) {
                             const declaration = symbol.valueDeclaration as VariableDeclaration | undefined;
-                            if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {
+                            if (declaration?.kind === SyntaxKind.VariableDeclaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) {

alternatively, I could check if the parent is not a BindingElement

Andarist

comment created time in a day

PullRequestReviewEvent

PR opened microsoft/TypeScript

Fixed na issue with evaluator using binding element initializers as const values

fixes https://github.com/microsoft/TypeScript/issues/55907

+235 -1

0 comment

10 changed files

pr created time in a day

create barnchAndarist/TypeScript

branch : fix/evaluator-binding-initializers

created branch time in a day

issue commentmicrosoft/TypeScript

Template string wrongly infers type from a default value used in destructuring assignment

It's actually an old bug but this one is a new manifestation of it. TS playground

LasAtt

comment created time in a day

issue openedrollup/rollup

Preserve reexports in a tree-shakeable form

Feature Use Case

I'd like to keep my libraries as tree-shakeable as possible

Feature Proposal

As we can see here: Rollup playground

we end up with a frozen object being exported because everything gets flat-bundled and because we used:

export * as maths  from './maths.js';

It would be great if a chunk could be (optionally?) created for all of such reexports to keep the code in a format that doesn't deoptimize most of the tree-shakers out there.

As an added bonus the same could be applied to:

import * as maths  from './maths.js';
export { maths };

created time in a day

issue commentmicrosoft/TypeScript

Template string wrongly infers type from a default value used in destructuring assignment

I'm almost certain that this is a fall out of https://github.com/microsoft/TypeScript/pull/53907 and it's definitely a bug. I'll look into this soon.

LasAtt

comment created time in a day

Pull request review commentmicrosoft/TypeScript

Fixed an issue with string mappings over generic intersections not being deferred in conditional types

 export function createTypeChecker(host: TypeCheckerHost): TypeChecker {             accessNode;
     }
 
-    function isPatternLiteralPlaceholderType(type: Type): boolean {
+    function isPatternLiteralPlaceholderType(type: Type, ignoreGenericIntersections = false): boolean {
         if (type.flags & TypeFlags.Intersection) {
-            return some((type as IntersectionType).types, t => !!(t.flags & (TypeFlags.Literal | TypeFlags.Null | TypeFlags.Undefined)) || isPatternLiteralPlaceholderType(t));

Oh, that's cool! Thanks for the tip. I was worried that addSpans would fail if I did something like this. It seems that (somewhat confusingly) isGenericIndexType already returns true for an intersection like this so addSpans is covered.

Andarist

comment created time in a day

PullRequestReviewEvent

push eventAndarist/TypeScript

Mateusz Burzyński

commit sha a6787385c31cd6d08c0f0c32800b8d69a70f8c33

Simplify the fix

view details

push time in 2 days

issue commentmicrosoft/TypeScript

Indexing/element access on `super` avoids instance property checks

I imagine that there are also other bugs here. checkElementAccessExpression doesn't end up checking if it's accessing on super at any layer (from what I can see quickly) and checkPropertyAccessibilityAtLocation can produce 2 other diagnostics as well (within the isSuper branch)

DanielRosenwasser

comment created time in 2 days

issue commentmicrosoft/TypeScript

unique symbol lost on assignment to const despite type assertion

I was referring to my branch :P TS playground

dragomirtitian

comment created time in 2 days

issue commentmicrosoft/TypeScript

unique symbol lost on assignment to const despite type assertion

https://github.com/microsoft/TypeScript/pull/54778 doesn't fix this because this value symbol isn't publicly accessible. The issue arises in the very same if statement that this PR touches though.

It probably would be possible to preserve this type by emitting smth like:

declare const u: unique symbol;
export declare const a1: typeof u

But the machine for this is not in place because those symbol types are widened at getWidenedTypeForVariableLikeDeclaration stage and not at the declaration emit - so the original information is lost before the declaration emitter has even a chance to deal with this.

Symbols are a little bit wonky in this regard so I assume that there are some intricacies to this that I'm not aware of etc. I found that preserving their types is often quite impossible without explicit type annotations. I could probably tweak my PR to handle this as well but I'm not exactly sure what should the rules for symbols be.

dragomirtitian

comment created time in 2 days

issue commentmicrosoft/TypeScript

TSC fatal error: Maximum call stack size exceeded

This is a circularity error combined with non-existent property. The problem is that when serializing the type within reportNonexistentProperty we end up calling isReadonlyAssignmentDeclaration which calls checkExpressionCached(d.arguments[2]) for this expando declaration member. When resolving the type of this descriptor argument we run into the mentioned circularity because it tries to call reportNonexistentProperty again.

Partially the problem is in the fact that reportNonexistentProperty gets called before we have a chance to assign the cached type of this expression. There is a way to use addLazyDiagnostic to overcome this problem slightly - but those are sometimes called eagerly despite being "lazy" (see checkSourceFileWithEagerDiagnostics). So in those scenarios, it doesn't solve anything.

The circularity could be detected (based on pushTypeResolution+popTypeResolution but I'm not sure where tracking for it should be added here. It would also be a surgical fix and it kind of feels that other typeToString calls might be affected by this problem as well.

Maybe some TS team member could advise on how this would be best handled (implementation-wise).

axetroy

comment created time in 2 days

pull request commentmicrosoft/TypeScript

Error on class fields accesses through `super` in JS files

Can you add a test for this case in JavaScript as well and confirm it works?

Added both - I had to fix one of them 😉

Andarist

comment created time in 2 days

Pull request review commentmicrosoft/TypeScript

Error on class fields accesses through `super` in JS files

+index.js(20,22): error TS2855: Class field 'roots' defined by the parent class is not accessible in the child class via super.
+index.js(23,22): error TS2855: Class field 'foo' defined by the parent class is not accessible in the child class via super.
+index.js(26,22): error TS2855: Class field 'justProp' defined by the parent class is not accessible in the child class via super.
+index.js(29,22): error TS2855: Class field ''literalElementAccess'' defined by the parent class is not accessible in the child class via super.
+
+
+==== index.js (4 errors) ====
+    // https://github.com/microsoft/TypeScript/issues/55884
+    
+    class YaddaBase {
+        constructor() {
+            this.roots = "hi";
+            /** @type number */
+            this.justProp;
+            /** @type string */
+            this['literalElementAccess'];
+            
+            this.b()
+        }
+        accessor b = () => {
+            this.foo = 10
+        }
+    }
+    
+    class DerivedYadda extends YaddaBase {
+        get rootTests() {
+            return super.roots;
+                         ~~~~~
+!!! error TS2855: Class field 'roots' defined by the parent class is not accessible in the child class via super.
+        }
+        get fooTests() {
+            return super.foo;
+                         ~~~
+!!! error TS2855: Class field 'foo' defined by the parent class is not accessible in the child class via super.
+        }
+        get justPropTests() {
+            return super.justProp;
+                         ~~~~~~~~
+!!! error TS2855: Class field 'justProp' defined by the parent class is not accessible in the child class via super.
+        }
+        get literalElementAccessTests() {
+            return super.literalElementAccess;

Can you add a test for super["literalElementAccess"] as well?

Good catch. It doesn't work correctly today (TS playground) even in TS files. For that reason - I'd say that this is a separate issue. I can look into it as well but I'd prefer to explore it separately.

Also, can you just add a test for super.b? I bet we have no test for super. on an accessor declaration at all.

Sure thing, just added it.

Andarist

comment created time in 2 days

PullRequestReviewEvent
more