Skip to content

Added deprecated section to annotation docs #19

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

Merged
merged 7 commits into from
Dec 30, 2020

Conversation

lolleko
Copy link
Member

@lolleko lolleko commented Dec 22, 2020

Should be merged once a new version with the changes from TypeScriptToLua/TypeScriptToLua#949 is released

TODO:

  • add instructions for pureabstract (Dota example)
  • instructions for phantom?
  • instructions for extension (same as pureabstract?)
  • metaextension (same as pureabstract but with debug.getregistry)

@lolleko lolleko requested a review from Perryvw December 27, 2020 00:07
@lolleko lolleko marked this pull request as ready for review December 27, 2020 00:08

## @extension

<DeprecatedInVersion deprecated="0.37.0" removed="TBD"></DeprecatedInVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<DeprecatedInVersion deprecated="0.37.0" removed="TBD"></DeprecatedInVersion>
<DeprecatedInVersion deprecated="0.37.0" removed="TBD" />

There are multiple lines like this one which should be changed if this change is acceptable

@@ -0,0 +1,18 @@
import React from "react";

export function SmallCallout({ children, serverity = "warning" }: { children: React.ReactNode; serverity: string }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export function SmallCallout({ children, serverity = "warning" }: { children: React.ReactNode; serverity: string }) {
export function SmallCallout({ children, severity = "warning" }: { children: React.ReactNode; severity?: string }) {
  • Spell check serverity -> severity
  • Severity has a default value, but is considered to be required
    • The default value is never actually used so the default could be removed, or the severity be required

If this line is becoming too long this is another common TSX syntax I see used, but it isn't used in this codebase

type Props = {
  children: React.ReactNode;
  severity?: string;
};

export const SmallCallout: React.FC<Props> = ({ children, severity = "warning" }) => {
  return (...);
};

}

> :last-child {
padding-left: 5px;
padding-right: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering what happened to the sideBySide whilst making these changes

Copy link
Member Author

Choose a reason for hiding this comment

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

I disliked how long lines inside sidebyside would cause this ugly overflow and really small right/left sides. Now it wraps if there is not enough space to display both elements in one row. Similar to how it wraps on mobile devices.

Before:
Screenshot 2020-12-27 at 10 19 32

Now:
Screenshot 2020-12-27 at 10 19 44

Copy link
Member Author

@lolleko lolleko Dec 27, 2020

Choose a reason for hiding this comment

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

Oh and <DeprecatedInVersion> looks like this:
Screenshot 2020-12-27 at 11 34 52

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, good change, thanks for the pictures 👍

myFunction(): void;
}

declare const ExistingClassTable: MyBaseClass;
Copy link
Member

Choose a reason for hiding this comment

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

Why did you go with this over

interface ExistingClass {
    myFunction(): void;
}
ExistingClassTable.myFunction = function() {};

(For example ExistingClass = CDotaGameRules and ExistingClassTable = GameRules (already exists))

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to your example.


:::warning
Some annotations are deprecated and will be/have been removed.
The docs are only valid for older versions and include some instructions on how to replace the annotations with vanilla TS.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The docs are only valid for older versions and include some instructions on how to replace the annotations with vanilla TS.
Below are the deprecated annotations and instructions to recreate their behavior with vanilla TypeScript.

function myFunction() end
```

</SideBySide>
Copy link
Member

Choose a reason for hiding this comment

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

Upgrade instructions: Use ECMAScript modules and import/export. Alternatively, use a real (non-phantom) namespace.


**Upgrade Instructions**

Use interface merging.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe mention preferred is to declare interfaces over classes, otherwise use the the TS below.

@Perryvw Perryvw merged commit 2f94fd9 into source Dec 30, 2020
@Perryvw Perryvw deleted the deprecate-some-annotations branch December 30, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants