Skip to content

Added deprecated section to annotation docs#19

Merged
Perryvw merged 7 commits into
sourcefrom
deprecate-some-annotations
Dec 30, 2020
Merged

Added deprecated section to annotation docs#19
Perryvw merged 7 commits into
sourcefrom
deprecate-some-annotations

Conversation

@lolleko

@lolleko lolleko commented Dec 22, 2020

Copy link
Copy Markdown
Member

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
Comment thread docs/advanced/compiler-annotations.md Outdated

## @extension

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

Copy link
Copy Markdown
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

Comment thread src/components/SmallCallout/index.tsx Outdated
@@ -0,0 +1,18 @@
import React from "react";

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@lolleko lolleko Dec 27, 2020

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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 👍

Comment thread docs/advanced/compiler-annotations.md Outdated
myFunction(): void;
}

declare const ExistingClassTable: MyBaseClass;

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread docs/advanced/compiler-annotations.md Outdated

:::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
Copy Markdown
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
Copy Markdown
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.

Comment thread docs/advanced/compiler-annotations.md Outdated

**Upgrade Instructions**

Use interface merging.

Copy link
Copy Markdown
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