Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parse] - Project cleanup and fix for Object.set/save #52592

Merged
merged 8 commits into from
May 1, 2021

Conversation

ridem
Copy link
Contributor

@ridem ridem commented Apr 26, 2021

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

Changes, in the order of the 4 commits:

  • Align @types/parse with Definitely Typed's prettier rules: npm run prettier -- --write types/parse/**. See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/394b6f5ceedd3acaea0d183f8d2c9b7117c8b3f3/README.md#common-mistakes
  • Various project cleanup fixes
    • Removes the ts4.0 folder. Tests for the default types are passing from 3.7 to 4.3, and a split at ts4.0 is quire rare in the rest of this repo (even @types/node doesn't have one).
    • Set up the project so that no-self-import isn't needed. This means node.d.ts imports ./index instead of parse.
  • Re-align ts3.6 with the last changes from the default types folder.
  • Fix for Parse.Object set and save methods. The tricks in use don't appear to be fixing any issue but make code completion difficult. They also break in some cases

Result of the following command:
`npm run prettier -- --write types/parse/**/*.ts`
- Remove unnecessary ts4.0 folder
- Remove `no-self-import` rule
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Apr 26, 2021
@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 26, 2021

@ridem Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners, DT maintainers or others

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 52592,
  "author": "ridem",
  "headCommitOid": "df7a2894ebb4a1fd1c8ad5e62cfe1215c4533c0d",
  "lastPushDate": "2021-05-01T09:13:13.000Z",
  "lastActivityDate": "2021-05-01T11:20:09.000Z",
  "maintainerBlessed": false,
  "mergeOfferDate": "2021-05-01T10:52:08.000Z",
  "mergeRequestDate": "2021-05-01T11:20:09.000Z",
  "mergeRequestUser": "ridem",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "popularityLevel": "Well-liked by everyone",
  "pkgInfo": [
    {
      "name": "parse",
      "kind": "edit",
      "files": [
        {
          "path": "types/parse/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/node.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/package.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/parse/parse-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/parse/react-native.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts3.6/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts3.6/node.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts3.6/parse-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/parse/ts3.6/react-native.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts4.0/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts4.0/node.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts4.0/parse-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/parse/ts4.0/react-native.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/ts4.0/tsconfig.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/parse/ts4.0/tslint.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/parse/tslint.json",
          "kind": "package-meta-ok"
        },
        {
          "path": "types/parse/v1/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/parse/v1/parse-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "ullisenmedia",
        "dpoetzsch",
        "jaeggerr",
        "flavionegrao",
        "wesleygrimes",
        "owsas",
        "agoldis",
        "AlexandreHetu",
        "dplewis",
        "yomybaby",
        "pocketcolin",
        "rdhelms",
        "jlnquere",
        "tybi",
        "RaschidJFR",
        "jeffgukang",
        "buitanloc",
        "LinusU",
        "JeromeDeLeon",
        "kentrh",
        "L3K0V",
        "swittk"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Well-liked by everyone"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "rdhelms",
      "date": "2021-05-01T10:48:59.000Z",
      "isMaintainer": false
    }
  ],
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @ullisenmedia @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu @dplewis @yomybaby @pocketcolin @rdhelms @jlnquere @tybi @RaschidJFR @JeffGuKang @buitanloc @LinusU @JeromeDeLeon @kentrh @L3K0V @swittk — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@@ -457,25 +457,9 @@ declare global {
remove: this["add"];
removeAll: this["addAll"];
revert(...keys: Array<Extract<keyof (T & CommonAttributes), string>>): void;
save<K extends Extract<keyof T, string>>(
attrs?:
| (((x: T) => void) extends (x: Attributes) => void
Copy link
Contributor Author

@ridem ridem Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true:

((x: T) => void) extends (x: Attributes) => void
  • when T is defined and just has optional keys
  • when T is already Parse.Attributes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ridem This would break the following case (which should be added as a test case - it doesn't look we currently have one)

    async function testSave(
        objUntyped: Parse.Object,
        objTyped: Parse.Object<{ example: boolean; someString: string }>,
    ) {
        // $ExpectError
        await objTyped.save({ example: undefined })
    }

That should error with Type 'undefined' is not assignable to type 'boolean'. but your change would allow it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify here: the only reason why this case should error (in my opinion) is because the attributes had been typed without allowing undefined. For the case where the attributes ARE typed either as Partial or with properties typed as undefined, I'm fine allowing those to be set as undefined.

My problem was just with the Partial<T>, but I think Pick<T, K> | T seems to work great.

@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

master #52592 diff
Batch compilation
Memory usage (MiB) 121.7 130.9 +7.6%
Type count 25516 25913 +2%
Assignability cache size 8389 8622 +3%
Language service
Samples taken 2618 2676 +2%
Identifiers in tests 2618 2676 +2%
getCompletionsAtPosition
    Mean duration (ms) 761.8 701.8 -7.9%
    Mean CV 3.9% 4.6%
    Worst duration (ms) 1162.7 1085.1 -6.7%
    Worst identifier Parse query
getQuickInfoAtPosition
    Mean duration (ms) 769.9 711.0 -7.6%
    Mean CV 3.8% 4.7%
    Worst duration (ms) 1202.9 1595.5 +32.6% 🔸
    Worst identifier Parse notContainedIn
System information
Node version v14.16.0 v14.16.1
CPU count 2 2
CPU speed 2.294 GHz 2.294 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1111-azure 4.15.0-1113-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

Looks like there were a couple significant differences—take a look at worst-case duration for getting quick info at a position to make sure everything looks ok.

@typescript-bot typescript-bot added the Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. label Apr 26, 2021
Copy link
Contributor

@rdhelms rdhelms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ridem What's your use case that led you to make this PR? The change as you have it would break existing functionality.
Also, it looks like you had some autosave lint config applied here, which changed all the ' -> ".
Interesting...I didn't know DefinitelyTyped updated their single/double quote preference a couple months ago

@@ -457,25 +457,9 @@ declare global {
remove: this["add"];
removeAll: this["addAll"];
revert(...keys: Array<Extract<keyof (T & CommonAttributes), string>>): void;
save<K extends Extract<keyof T, string>>(
attrs?:
| (((x: T) => void) extends (x: Attributes) => void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ridem This would break the following case (which should be added as a test case - it doesn't look we currently have one)

    async function testSave(
        objUntyped: Parse.Object,
        objTyped: Parse.Object<{ example: boolean; someString: string }>,
    ) {
        // $ExpectError
        await objTyped.save({ example: undefined })
    }

That should error with Type 'undefined' is not assignable to type 'boolean'. but your change would allow it.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Apr 26, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Apr 26, 2021
@typescript-bot
Copy link
Contributor

@ridem One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label Apr 27, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Apr 27, 2021
@ridem
Copy link
Contributor Author

ridem commented Apr 27, 2021

Thanks for the quick answer, @rdhelms.

What's your use case that led you to make this PR?

Several reasons:

  1. Keep IntelliSense working with set() and save()

Not having autocompletion suggestions on things like: myObject.set({}) is very annoying

  1. Being able to work with Partial<Attributes> in the codebase.

Basically being able to do things like this:

type BookAttributes = {
    author: string; title: string;
}

class Book extends Parse.Object<BookAttributes> {
    constructor(options?: any) {
        super("Book", options);
    }

    setTolkienBook(attrs: Partial<BookAttributes>) {
        this.set({
            ...attrs,
            author: "Tolkien"
        })
    }
}
  1. Set up the project so that it's less intimidating for future PRs

This is a warmup for which I read the README and fixed a few things to get @types/parse to be closer to the conventions. Removing an unnecessary folder and aligning the formatting all went in that direction. I intend on adding support for dot notation queries with a typesVersions on ts4.1.


About undefined values:

Thanks a lot for clarifying what the intent was with this. I've added a commit that includes:

  • Tests for when undefined is a value, in various contexts. Notably, the previous types for set and save weren't reliable when all keys of the Attributes were already optional (tests using objTypedOptional were failing)
  • Updated definitions for set and save that forbid undefined while still making IntelliSense work

For my use case n°2, I understand that this isn't possible if you do rely on forbidding undefined values in your setup, so I'm not going forward with this. I don't have a full picture over how many people rely on this guard versus how many people are annoyed that they can't simply pass a Partial of their attributes to set and save.

AFAIK Parse isn't meant to throw when you pass an undefined value, the behaviour is just a bit weird:

  • The object's attribute is set locally, but it's a no-op on the server
  • There might still be a bug for when called server-side with directAccess: true, but this isn't intended.

There are other places which would need guards to forbid undefined values, but are tricky to implement, notably:

class Test extends Parse.Object<{title?: string;}> {}
new Test("Test", { title: undefined })

or

function testSet( objUntyped: Parse.Object) {
    // $ExpectType false | Object<Attributes>
    objUntyped.set({ propA: undefined });
}

Is it the types job to forbid these undefined values in a few cases (and not others) at the expense of other useful uses?

microsoft/TypeScript#43805 is an interesting read about how the issue might be tackled in future releases.


To sum up what the PR is doing:

  • Remove an unnecessary typesVersions folder (ts4.0)
  • Remove a tslint rule override which was easy to get rid of
  • Apply DefinitelyTyped's styling guidelines to the project (npm run prettier -- --write types/parse/**)
  • Put back IntelliSense on .set({}) and .save({})
  • [No change] undefined is still forbidden as a value in set and save when Attributes are specified. Added tests and comments to make that intent clearer

@typescript-bot
Copy link
Contributor

Updated numbers for you here from 90ef822. Nice job, these numbers look better.

Comparison details 📊
master #52592 diff
Batch compilation
Memory usage (MiB) 121.7 126.1 +3.6%
Type count 25516 27753 +9%
Assignability cache size 8389 9553 +14%
Language service
Samples taken 2618 2708 +3%
Identifiers in tests 2618 2708 +3%
getCompletionsAtPosition
    Mean duration (ms) 761.8 642.9 -15.6%
    Mean CV 3.9% 5.6%
    Worst duration (ms) 1162.7 1040.6 -10.5%
    Worst identifier Parse Parse
getQuickInfoAtPosition
    Mean duration (ms) 769.9 652.8 -15.2%
    Mean CV 3.8% 5.7%
    Worst duration (ms) 1202.9 978.9 -18.6%
    Worst identifier Parse Query
System information
Node version v14.16.0 v14.16.1
CPU count 2 2
CPU speed 2.294 GHz 2.095 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1111-azure 4.15.0-1113-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. and removed Perf: Worse typescript-bot determined that this PR has a negative impact on compilation performance. labels Apr 27, 2021
@rdhelms
Copy link
Contributor

rdhelms commented Apr 27, 2021

@ridem Thanks for the really useful explanation and summary. I'm testing your changes locally a bit before approving, but that all seems very promising.

We hadn't noticed any issues with Intellisense in our codebase (EDIT: I was able to reproduce some Intellisense issues with the currently published version - we just happened to be using architectural patterns that didn't hit those cases), because rather than using classes that extend Parse Object classes, we just create and use the Parse Objects directly, and .set() and .save() seem to work fine in those cases, even with Partial attributes (EDIT: When using new Parse.Object Intellisense actually breaks with objects that are NOT Partial...the behavior seems to reverse between that and extended classes). As an example (using @types/parse@2.18.3):
image

But it seems like you've improved the handling for cases like extended classes, so that seems great 👍🏻

For using undefined, our intent when first implementing generically typed Parse Objects wasn't to completely forbid passing undefined in all cases, it was just to make the passed values match the user's "schema" (aka the types of the Parse Object's attributes). In other words, if the attributes object has a property typed using ? or undefined, then the intent is to allow new Parse.Object(), .set(), and .save() to pass undefined for that property. But if the property is a required property, then the intent was to prevent accidentally setting that property's value to be undefined. So as an example, for your case of the Book class with setTolkienBook, I would expect that attempting to call this.set() with anything other than an object matching BookAttributes should fail. EDIT: I think calling this.set() with just some properties of BookAttributes (or {}) should work, but if any properties are set, they should match BookAttributes exactly. Also, I would expect calling super('Book', options) to fail if options is not a complete match for BookAttributes

class Book extends Parse.Object<BookAttributes> {
    constructor (options: BookAttributes) {
        super('Book', options)
    }

    setTolkienBook () {
        this.set({
            author: undefined,    // Errors, as expected
        })
    }
}

But, as you've rightfully pointed out, the existing types allow this.set({}) there, which to me is a bug.

class Book extends Parse.Object<BookAttributes> {
    constructor (options: BookAttributes) {
        super('Book', options)
    }

    setTolkienBook () {
        this.set({})    // ~~Should not work~~  EDIT: My bad - this actually should be fine
    }
}

I will also say that we've had a relatively limited scope of use cases and documented examples of how people are using this package, so I think it would be interesting to compare notes some more to make sure that we're taking as many cases, patterns, and architectures into account as possible.

@RaschidJFR or others, would you care to share how using this package (particularly the generically-typed Parse.Object with .save and .set) has been going for you? Have you noticed any other particular frustrations related to Intellisense or objects with undefined properties?

Comment on lines 1449 to 1464
/**
* Parse doesn't throw when a value is `undefined`,
* but saves won't be taken into account.
*/

// $ExpectError
await objTyped.save({ example: undefined });

// $ExpectError
await objTyped.save("example", undefined);

// $ExpectError
await objTypedOptional.save({ example: undefined });

// $ExpectError
await objTyped.save('wrongProp', true);
await objTypedOptional.save("example", undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah...I misinterpreted what you were saying in your other comment...so actually in these cases, since the attributes type explicitly types the properties as undefined, we would have allowed setting these. I do see how it could be beneficial to prevent ever setting a value to be undefined in order to force/guide users more towards .unset...but I do think that may be a bit heavy-handed.

More and more, I think the core issue for your case anyway is some difference between the behavior of class Thing extends Parse.Object<SomeAttributes> and new Parse.Object<SomeAttributes>('Thing'). It seems like the extended class is losing some TS context somehow...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote that we support these test cases:

        // $ExpectError
        await objTyped.save({ example: undefined });

        // $ExpectError
        await objTyped.save("example", undefined);

        // $ExpectType Object<OptionalObjectAttributes>
        await objTypedOptional.save({ example: undefined });

        // $ExpectType Object<OptionalObjectAttributes>
        await objTypedOptional.save("example", undefined);

Which, by removing the Required<> from your save() and set() types, I believe should all pass and also still support Intellisense for all kinds of attribute types, partial or not.

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Action in New Pull Request Status Board Apr 27, 2021
@typescript-bot typescript-bot moved this from Needs Maintainer Action to Waiting for Code Reviews in New Pull Request Status Board Apr 27, 2021
@typescript-bot
Copy link
Contributor

@rdhelms Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

Copy link
Contributor

@rdhelms rdhelms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ridem Ok - I think maybe I've come up with a solution to help with your Intellisense and extended class use case, while maintaining the existing behavior of the package thus far:

            save<K extends Extract<keyof T, string>>(
                attrs?: Pick<T, K> | T | null,
                options?: Object.SaveOptions,
            ): Promise<this>;
            save<K extends Extract<keyof T, string>>(key: K, value: T[K], options?: Object.SaveOptions): Promise<this>;
            set<K extends Extract<keyof T, string>>(
                attrs: Pick<T, K> | T | null,
                options?: Object.SetOptions,
            ): this | false;
            set<K extends Extract<keyof T, string>>(key: K, value: T[K], options?: Object.SetOptions): this | false;

I think this is possible now partly due to updates by the TS compiler since the time when these types were first written. The | T part of the union type is what particularly helps Intellisense, and that idea came from react's types for setState here:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L482

If that seems good to you, it would be great if you could adjust that but keep all the other improvements with linting, etc. And I would love to get a future PR figured out for handling dot notation with template literal types 😄

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Apr 29, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Apr 29, 2021
@typescript-bot
Copy link
Contributor

@ridem One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

Copy link
Contributor

@rdhelms rdhelms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ridem - I think this is great. It's some much needed cleanup, improved transparency, and a great fix for Intellisense on save and set.

I really appreciate the compromise we came to, because I know for my company's particular use we highly value how TS will error if we try to set something as undefined - we see that as a bug and never want to allow it in our own codebase. But since not everyone would want to be that strict, I think having the ability to opt out of those errors by using Partial or | undefined on an attribute is really valuable. And for those wanting even looser typings, we still have the parameter-less flavor of Parse.Object() which lets people set and save whatever attributes they want.

It's incredibly ironic that we independently found and cited the exact same line of react's types...initially when I saw your change with SafeAttributes, I was only focused on the Required part and didn't even think about the | T part. And then after my own research attempts, I just ended up at the exact thing that you had already found 😅

Let us know how the support for dot notation goes - we would love to get support for that, and are happy to help out if the effort becomes problematic.

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Apr 30, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Apr 30, 2021
@rdhelms
Copy link
Contributor

rdhelms commented Apr 30, 2021

Also, it seems like the CI builds are failing for something unrelated to parse - not sure what that's about. Looks like maybe it's from rxjs
7df6984

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Apr 30, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Apr 30, 2021
@rdhelms
Copy link
Contributor

rdhelms commented Apr 30, 2021

@sandersn It looks like our package's build is failing with errors related to rxjs...is it possible that we need to make updates related to your recent commit?

@sandersn
Copy link
Contributor

Yep, you'll need to merge from master to get rid of those errors.

@typescript-bot
Copy link
Contributor

Updated numbers for you here from 3f1a400.

Comparison details 📊
master #52592 diff
Batch compilation
Memory usage (MiB) 121.7 121.1 -0.5%
Type count 25516 26989 +6%
Assignability cache size 8389 8967 +7%
Language service
Samples taken 2618 2716 +4%
Identifiers in tests 2618 2716 +4%
getCompletionsAtPosition
    Mean duration (ms) 761.8 556.6 -26.9% 🌟
    Mean CV 3.9% 6.1%
    Worst duration (ms) 1162.7 835.2 -28.2% 🌟
    Worst identifier Parse objTyped
getQuickInfoAtPosition
    Mean duration (ms) 769.9 566.6 -26.4% 🌟
    Mean CV 3.8% 6.2%
    Worst duration (ms) 1202.9 940.5 -21.8%
    Worst identifier Parse query
System information
Node version v14.16.0 v14.16.1
CPU count 2 2
CPU speed 2.294 GHz 2.593 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1111-azure 4.15.0-1113-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

Wow, it looks like all the big movers moved in the right direction! Way to go! 🌟 I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added Perf: Better typescript-bot determined that this PR improves compilation performance. and removed Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. labels Apr 30, 2021
@ridem
Copy link
Contributor Author

ridem commented Apr 30, 2021

@rdhelms
For dot notation, I've published a working concept here if you want to have a look at it.
The main issue around it is choosing a solution for when a class could have a pointer to itself. Either this is fixed by setting a limit on recursion with a nice iterator, or with some smart detection forbidding a class including itself

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label May 1, 2021
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board May 1, 2021
@typescript-bot
Copy link
Contributor

@rdhelms Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot
Copy link
Contributor

Updated numbers for you here from 82f87d2.

Comparison details 📊
master #52592 diff
Batch compilation
Memory usage (MiB) 121.7 133.7 +9.9%
Type count 25516 26989 +6%
Assignability cache size 8389 8967 +7%
Language service
Samples taken 2618 2716 +4%
Identifiers in tests 2618 2716 +4%
getCompletionsAtPosition
    Mean duration (ms) 761.8 651.8 -14.4%
    Mean CV 3.9% 5.6%
    Worst duration (ms) 1162.7 1005.0 -13.6%
    Worst identifier Parse link
getQuickInfoAtPosition
    Mean duration (ms) 769.9 662.2 -14.0%
    Mean CV 3.8% 5.8%
    Worst duration (ms) 1202.9 1121.9 -6.7%
    Worst identifier Parse withinKilometers
System information
Node version v14.16.0 v14.16.1
CPU count 2 2
CPU speed 2.294 GHz 2.095 GHz
CPU model Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz
CPU Architecture x64 x64
Memory 6.8 GiB 6.8 GiB
Platform linux linux
Release 4.15.0-1111-azure 4.15.0-1113-azure

First off, note that the system varied slightly between these two runs, so you’ll have to take these measurements with a grain of salt.

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. and removed Perf: Better typescript-bot determined that this PR improves compilation performance. labels May 1, 2021
@typescript-bot typescript-bot added Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner labels May 1, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Waiting for Author to Merge in New Pull Request Status Board May 1, 2021
@ridem
Copy link
Contributor Author

ridem commented May 1, 2021

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board May 1, 2021
@typescript-bot typescript-bot merged commit 5d4a5a7 into DefinitelyTyped:master May 1, 2021
@typescript-bot
Copy link
Contributor

I just published @types/parse@2.18.6 to npm.

@typescript-bot
Copy link
Contributor

I just published @types/parse@1.11.8 to npm.

@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board May 1, 2021
@lamualfa
Copy link

lamualfa commented Jul 4, 2021

@ridem @rdhelms @sandersn Thank you very much.

But i have some problem when using ES 6 Minimized version as mentioned in official repo:

import Parse from 'parse/dist/parse.min.js';

When using the method above, the autocomplete will not showing. How to show the autocomplete even i use ES 6 Minimized version?


Updated (Solved)

as mentioned in these comment, you should specify the definition for related path in tsconfig.json file:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "parse/dist/parse": ["node_modules/@types/parse/index.d.ts"]
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants