Repository navigation
Adds updated examples - #43
Conversation
|
Fixes #25 |
Nathan Shively-Sanders (sandersn)
left a comment
There was a problem hiding this comment.
Some miscellaneous comments. I made some grammar cleanups but I don't know whether it's worthwhile to push them upstream yet.
Plus one reordering for comprehension (I hope).
Update `Code Flow.ts`
|
Type Acquisition for lodash and jest is rough - Lodash's types are kinda crazy, and Jests seems to send my browsers into an infinite loop. |
|
Yep, I got all those tools set up for projects before - will definitely do that 👍 |
|
OK, this now has an implementation in the playground orta/typescript-play#17 This can be tested in this netlify draft deploy |
| @@ -0,0 +1,110 @@ | |||
| // Without a background in type theory, you're unlikely | |||
There was a problem hiding this comment.
Another unsound feature that might be worth mentioning is this (I can't think of an example that isn't contrived right now, so maybe it's not a good inclusion!)
// We can always add an extra optional property to a type.
const obj: { x: string; y? : number } = { x: "a property "};
// However in combination with the ability to 'forget' properties this can
// can be unsound.
const objXY = { x: "a property", y: true };
const objX: { x: string } = objXY;
const objXYNumber: { x: string, y?: number } = objX;
const num: number = objXYNumber.y === undefined ? 0 : objXYNumber.y;
// Excess property checking can prevent errors like this when you
// initialise your objects with annotations:
const objXYAnnotation: { x: string } = { x: "a property", y: true }; // error|
|
Chris Krycho (chriskrycho)
left a comment
There was a problem hiding this comment.
This is fantastic! I'm going to try to read through all of it and note anything that stands out along the way over the next week or so, but general sentiment after perusing a few of the examples is just 😍 💯 🎉 – this mode is a great way of helping people learn, and the content is 👍
Typos for README.md
Typos for Generic Classes.ts
Typos for Mixins.ts
Typos for This.ts
Typos for Classes 101.ts
Typos for Types vs Interfaces.ts
Typos for Soundness.ts
Typos for Structural Typing.ts
Typos for Type Widening:Narrowing.ts
Typos for Conditional Types.ts
Typos for JSDoc Support.js
Typos for Discriminate Types.ts
Typos for Import:Export.ts
Typos for Indexed Types.ts
Typos for Async:Await.ts
Typos for Any.ts
Typos for Objects and Arrays.ts
Typos for Literals.ts
Typos for Quick Fixes.ts
Typos for Union and Intersection Types.ts
Typos for Function Chaining.ts
Typos for Unknown and Never.ts
Typos for TypeScript + WebGL.js
Typos for Built-in Utility Types.ts
Typos for TypeScript + Node.js
Typos for Tuples.ts
Typos for TypeScript + Deno.ts
Typos for generateTOC.js
Typos for README.md
Got false positives?Make changes to the global settings spellcheck.json in /artsy/peril-settings. Typos for Enums.ts
|
0377847 to
931eafa
Compare
|
w00t! So good, thanks Orta Therox (@orta) 🎉 👏👏👏 |

This PR is a collect-all for playground based documentation. Unlike the handbook which aims to be thorough and definitive - the examples in the playground are based on providing a few primitives per example and a narrative about why/when you'd use them in a browser environment
You can try it in https://5d6c47101cff21a89609f849--ts-playground.netlify.com/play/index.html?strict=false#example/objects-and-arrays
I'm now good for content feedback!