profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/tianzhich/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Zhi Tian tianzhich Kwai Beijing Coding like a Pro.

rematch/rematch 7481

The Redux Framework

tianzhich/message-board 3

基于React+PouchDB实现的留言板

tianzhich/nx-plugin-demo 3

博客《如何写一个Nx schematic plugin》示例代码:https://juejin.im/post/5f092f366fb9a07e926ce40c

tianzhich/blog 2

My Blog

tianzhich/counseling-system-fe 1

Psychological Counseling System FE

tianzhich/ant-design 0

🌈 A UI Design Language and React UI library

tianzhich/artipub 0

Article publishing platform that automatically distributes your articles to various media channels

tianzhich/counseling-system 0

Psychological Counseling System

tianzhich/Critical-Rendering-Path-Demo 0

The demos about critical rendering path

push eventrematch/rematch

liuqiang1357

commit sha f4107ba811ad8239dccf42a7cf83fe2883166233

fix: immer behaves unexpectedly when model state is a nullable primitive value (#928) * fix: immer behaves unexpectedly when model state is a nullable primitive value * docs(immer): remove the outdated comment Co-authored-by: Zhi Tian <zhi.tian@yahoo.com>

view details

push time in 2 days

PR merged rematch/rematch

Reviewers
fix: immer behaves unexpectedly when model state is a nullable primitive value

By the way, why we treat primitive different from object value? I think the default behavior is ok.

+25 -8

0 comment

2 changed files

liuqiang1357

pr closed time in 2 days

PullRequestReviewEvent

push eventliuqiang1357/rematch

Zhi Tian

commit sha 1fe12765c218a5c1733047f0b5cfdb5fef6e627d

docs(immer): remove the outdated comment

view details

push time in 2 days

delete branch rematch/rematch

delete branch : pr/liuqiang1357/928

delete time in 2 days

create barnchrematch/rematch

branch : pr/liuqiang1357/928

created branch time in 2 days

issue commentconventional-commits/conventionalcommits.org

Chore commit type

I feel like chore is kinda too generic. I've replaced it with ci, build, vcs and enhance.

@tianzhich What's your usage?

Yes - It's too generic so different teams use it in different ways. There are two teams in my company department, one of them use it like ci or build, another use it just like this words meaning some bothering little changes. IMO the conventional-commits team could remove it like Angular team or replaced it with some more specific words like what you did.

aleksator

comment created time in 2 days

issue commentconventional-commits/conventionalcommits.org

Chore commit type

Is the chore replaced by ci and build? I saw some articles or comments that said this. But from this commit angular delete the chore type as it was overused, but not prepare to replace it with ci and build.

aleksator

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentrematch/rematch

fix: immer behaves unexpectedly when model state is a nullable primitive value

 export type ImmerPluginConfig = { function wrapReducerWithImmer(reducer: Redux.Reducer) { 	// reducer must return value because literal don't support immer

If it means this way, we may need to remove this comment. Now immer support returns any value except the undefined.

liuqiang1357

comment created time in 3 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentrematch/rematch

fix: immer behaves unexpectedly when model state is a nullable primitive value

 export type ImmerPluginConfig = { function wrapReducerWithImmer(reducer: Redux.Reducer) { 	// reducer must return value because literal don't support immer

Is this mean reducer must return object value because immer don't support primitive values? @semoal

liuqiang1357

comment created time in 3 days

issue commentrematch/rematch

🔥 Official Rematch book ready to pre-order - Redux made easy with Rematch 🆕

What a nice book! Hope you guys like it.

semoal

comment created time in 17 days

startedmicrosoft/TypeScript

started time in 17 days

startedbellard/quickjs

started time in 22 days

startedmadnight/githut

started time in 23 days

issue commentmicrosoft/TypeScript

Type guard failed when using union typed variable for props

@RyanCavanaugh In that case probably is a bug or design limitation (I'm not sure):

interface PluginHook {
    onStoreCreated?: (p1: string) => void;
    onModel?: (p2: string) => void;
}

declare const plugins: PluginHook[];

function func<Hook extends keyof PluginHook>(method: Hook, fn: (p: NonNullable<PluginHook[keyof PluginHook]>) => void): void {
    for (const plugin of plugins) {
        const hook = plugin[method];
        if (typeof hook !== "undefined") {
            fn(hook);
            // ^^^^
            /*
            Argument of type 'PluginHook[Hook]' is not assignable to parameter of type '((p1: string) => void) | ((p2: string) => void)'.
              Type '((p1: string) => void) | ((p2: string) => void) | undefined' is not assignable to type '((p1: string) => void) | ((p2: string) => void)'.
                Type 'undefined' is not assignable to type '((p1: string) => void) | ((p2: string) => void)'.
                  Type 'PluginHook[Hook]' is not assignable to type '(p2: string) => void'.
                    Type '((p1: string) => void) | ((p2: string) => void) | undefined' is not assignable to type '(p2: string) => void'.
                      Type 'undefined' is not assignable to type '(p2: string) => void'.
            */
        }
        if (hook) {
            fn(hook);
            // ^^^^
            /*
            Argument of type 'PluginHook[Hook]' is not assignable to parameter of type '((p1: string) => void) | ((p2: string) => void)'.
              Type 'PluginHook[Hook]' is not assignable to type '(p2: string) => void'.
            */
        }
        if (!!hook) {
            fn(hook);
            // ^^^^
            /*
            Argument of type 'PluginHook[Hook]' is not assignable to parameter of type '((p1: string) => void) | ((p2: string) => void)'.
              Type 'PluginHook[Hook]' is not assignable to type '(p2: string) => void'.
            */
        }
    }
}

Expected: It works

Actual: It say is not compatible. Changing the order of the if display the same errors in the exact order. The first error says that can be undefined just after checking for undefined.

Playground

it was fixed in 4.3.x

tianzhich

comment created time in 24 days

pull request commentmrmlnc/less-symbols-parser

fix: add try-catch block to avoid edge cases

related #7

tianzhich

comment created time in a month

PR opened mrmlnc/less-symbols-parser

fix: add try-catch block to avoid edge cases

Before there is a better approach. I just want to add the try-catch block to avoid these cases. Otherwise, only the try-catch block in vscode-less will handle this and it would break all the intelligence of this file, include other symbols like variables, imports, etc...

+9 -1

0 comment

1 changed file

pr created time in a month

create barnchtianzhich/less-symbols-parser

branch : fix-mixin-parser

created branch time in a month

startedmrmlnc/less-symbols-parser

started time in a month

issue commentmrmlnc/less-symbols-parser

makeMixinParameters throws TypeError: Cannot read property '1' of null

Yes, we need to support rest arguments pattern. And also, the parameter of mixins is not the same as a normal variable, it could just be an arbitrary word for pattern matching.

So these two edge cases would break the params splitting and the token matching in makeMixinParameters:

function makeMixinParameters(text: string, offset: number): IVariable[] {
	const variables: IVariable[] = [];
	if (text === '()') {
		return variables;
	}

	// Remove parenthesis
	text = text.slice(1, text.length - 1);
	const params = text.split(/([,;]\s*)(?=@)/);

	// Skip `(`
	offset += 1;

	for (let i = 0; i < params.length; i = i + 2) {
		const token = params[i];
		const stat = token.match(/([\n\t\r\s]*)(@[\w-]+)(?:\s*:\s*(.*))?/);
	}
// ...
}

I've tried to modify it like this:

image

But there is a case would failed:

.foo(@color: rgba(0,0,0,0), bar)

I couldn't find a proper way to split the params if (?=@) this restriction is unnecessary.

Looking forward to your help @mrmlnc if you have any free time.

Ciantic

comment created time in a month

fork tianzhich/less-symbols-parser

A very simple and fast Less parser for Mixins, Variables and Imports.

fork in a month

issue commentmrmlnc/vscode-less

Autocomplete failed while using pattern-matching mixins

Maybe this is related to https://github.com/mrmlnc/less-symbols-parser/issues/7

tianzhich

comment created time in a month

fork tianzhich/vscode-less

:electric_plug: Less intellisense for Variables and Mixins in all Less files.

https://goo.gl/9myVWD

fork in a month

startedmrmlnc/vscode-less

started time in a month

issue commentrematch/rematch

Alternative to API bullet points

The readability is not cool. Just want to explore other alternatives to make it easier, more readable and more beauty

I referred to the Redux doc site. I think they are similar to us.

semoal

comment created time in a month

pull request commentrematch/rematch

feat: loading plugin returns success/error/loading

plz check my commits and comments @semoal.

semoal

comment created time in a month

push eventrematch/rematch

tianzhich

commit sha 4de8f1973670bbd4d8fa9dbc0c57239f8ad5c102

docs(loading): use correct deprecated JSDoc comment

view details

tianzhich

commit sha 6a289f23d74c4a34dcff6183b53674f43c9bd198

refactor(loading): reduce duplication codes

view details

tianzhich

commit sha 24c1ddffda47dd72b3ada1f158e9666c043603ba

fix(loading): fix ts related crashes

view details

push time in a month