Skip to content

feat: add links ts playground #155

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 12 commits into from
Oct 13, 2019

Conversation

jsjoeio
Copy link
Collaborator

@jsjoeio jsjoeio commented Oct 11, 2019

This PR resolves #134

Changes:

  • add TypeScript Playground link to various examples (generally, the larger ones)
  • add @jsjoeio as a maintainer in the maintainers section
  • fix contributors shield to actually show number

@@ -910,7 +930,7 @@ export function App() {
);
}
export function Component() {
const { state, update } = React.useContext(TextProvider);
const { state, update } = React.useContext(TextContext);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TypeScript actually caught this in the Playground 😄

**Type Guarding**: Sometimes Union Types solve a problem in one area but create another downstream. If `A` and `B` are both object types, `A | B` isn't "either A or B", it is "A or B or both at once", which causes some confusion if you expected it to be the former. Learn how to write checks, guards, and assertions (also see the Conditional Rendering section below). For example:

```ts
interface Admin {
role: string:
role: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TypeScript caught this one too 💯

@eps1lon
Copy link
Member

eps1lon commented Oct 12, 2019

This is a great first step. TypeScript playground with automatic type aquisition will help a lot.

I would like the default options to be as strict as possible though. No strictNullChecks would be suspicious to me for new code written in TypeScript.

I'm a bit concerned about the maintenance this requires. We would need to check that the playground is updated properly when someone edits a snippet, right? I guess we'll see if this becomes a problem and then try to improve.

@jsjoeio
Copy link
Collaborator Author

jsjoeio commented Oct 12, 2019

@eps1lon Thanks for the feedback! Good point on the default options.

I'm a bit concerned about the maintenance this requires. We would need to check that the playground is updated properly when someone edits a snippet, right?

I don't think so. I mean, I wouldn't expect the playground to have breaking changes when it updates, but I'd say let's give it a shot and see how it works.

Besides checking strickNullChecks in the config, are there any others you would like me to have checked?

image

In addition to updating all the links, I think I should also update the CONTRIBUTING.md with guidelines around TypeScript Playground links. That way, it's documented and we can point to that for future PRs which include TS Playground links.

@eps1lon
Copy link
Member

eps1lon commented Oct 13, 2019

I don't think so. I mean, I wouldn't expect the playground to have breaking changes when it updates, but I'd say let's give it a shot and see how it works.

But we do have to update the contents and therefore the link, no?

Besides checking strickNullChecks in the config, are there any others you would like me to have checked?

The default options when visiting http://www.typescriptlang.org/play/index.html:
Screenshot from 2019-10-13 08-51-01

@jsjoeio
Copy link
Collaborator Author

jsjoeio commented Oct 13, 2019

But we do have to update the contents and therefore the link, no?

Oh, I misunderstood what you meant the first time. Yeah, you're right. But hopefully that shouldn't be too much of a hassle. Guess we'll have to give it a shot like you said.

Cool! I'll update the Playground links and use those options!

@jsjoeio
Copy link
Collaborator Author

jsjoeio commented Oct 13, 2019

@eps1lon Okay, I think it's ready for a second look

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@jsjoeio jsjoeio merged commit 141e554 into master Oct 13, 2019
@jsjoeio jsjoeio deleted the jsjoeio/issue-134/add-links-ts-playground branch October 13, 2019 16:43
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.

Add links to the TypeScript playground
2 participants