Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Create Keywords.md #344

Closed
wants to merge 51 commits into from
Closed

Create Keywords.md #344

wants to merge 51 commits into from

Conversation

zspitz
Copy link

@zspitz zspitz commented Jul 17, 2016

Fixes #341

cc @mhegazy

@zspitz zspitz mentioned this pull request Jul 17, 2016
@zspitz
Copy link
Author

zspitz commented Jul 17, 2016

Keyword | Description
---|---
any | [Describes a type unknown at design time](http://www.typescriptlang.org/docs/handbook/basic-types.html#any)
boolean | [Boolean](http://www.typescriptlang.org/docs/handbook/basic-types.html#boolean)
Copy link
Contributor

Choose a reason for hiding this comment

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

use lower case type names, so as not to mix them with boxed types, Number, String, etc..

Copy link
Contributor

Choose a reason for hiding this comment

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

also add never.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed lowercase and never

@mhegazy
Copy link
Contributor

mhegazy commented Jul 17, 2016

thanks @zspitz. since this is intended to be an index of sorts, i would recommend merging them all in one table. left column has one key word, all sorted alphabetically of course. the right column can have multiple links based on the context. for the JS keywords, i would also add links to MDN documentation or ES6 spec.

@zspitz
Copy link
Author

zspitz commented Jul 17, 2016

since this is intended to be an index of sorts, i would recommend merging them all in one table. left column has one key word, all sorted alphabetically

@mhegazy I'm thinking that an alphabetical arrangement might be important on paper, but within the browser there's not much benefit -- it's always possible to do CTRL+F to find a specific keyword on the page. However, isn't there added value in the grouping - type annotations, type modifiers, member modifiers etc.?
In any case, there is probably no benefit in splitting the Javascript-only keywords from the rest (e.g. class).

@mhegazy
Copy link
Contributor

mhegazy commented Jul 17, 2016

Well.. then what is the value of this page in general. you can always search this repo for keywords and that should get you close. like class would get you all the relevant areas. I was thinking of this more of a keyword index to get you quickly where you want, so you can look up as, and know it is used in 1. ES6 module declaration or 2. a post fix type assertion operator; similarly async would get you to some documentation about async functions in general.

@zspitz
Copy link
Author

zspitz commented Jul 17, 2016

@mhegazy

you can always search this repo for keywords and that should get you close. like class would get you all the relevant areas.

I think many people would be coming from the Handbook link on the Typescript website, and not through the repo, thus repo search can't be counted on. Unless the plan is to eventually have that link refer to the repo (similar to the spec), and not to http://www.typescriptlang.org/docs?

so you can look up as, and know it is used in ...

True. But perhaps sometimes you want to look up the available usages (basic type, type modifier, property modifier etc.) and quickly find out from there which keywords can fill each role. (I'm thinking computed enums here, which can be looked up in both directions...). Admittedly, the hard part will be to figure out the different usage groups first.

Perhaps both views are in order?


Keyword |
---|
of|
Copy link
Member

Choose a reason for hiding this comment

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

for-of

Copy link
Author

Choose a reason for hiding this comment

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

zspitz and others added 7 commits July 20, 2016 13:19
I'm getting started with TypeScript and I was linked to this
repository from a few different places. I do not believe the readme is
informative enough to newcomers.

After some more research it seems that this handbook is meant to be
read online, or from the Markdown files directly in this repository.

If this is incorrect, I will gladly update the readme, or I would
appreciate it if someone more knowledgeable could provide some insight
thanks :)
Add instructions on how to read the handbook.
@zspitz
Copy link
Author

zspitz commented Aug 1, 2016

@mhegazy @DanielRosenwasser I think this is pretty much complete. Could you look over it and see if I've missed anything? Any other thoughts?

| `as` | `export as namespace` _namespace_ | [Environment/modules](#environment-modules) | [UMD/isomorphic modules](Modules.md#umd-modules) | |
| `async` | | [Functions](#functions) | Marks function as asynchronous | [ES draft](http://tc39.github.io/ecmascript-asyncawait/), [PR#1664](https://github.com/Microsoft/TypeScript/issues/1664), [spec](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#68-asynchronous-functions) |
| `await` | | [Functions](#functions) | Waits for value within an asynchronous function | [ES draft](http://tc39.github.io/ecmascript-asyncawait/), [PR#1664](https://github.com/Microsoft/TypeScript/issues/1664), [spec](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#68-asynchronous-functions) |
| `boolean` | | [Predefined type](#predefined-types) | [`boolean` type](Basic%20Types.md#boolean) | |
Copy link
Contributor

Choose a reason for hiding this comment

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

use "Primitive Type" instead of "Predefined type". this is how the TypeScript spec refers to them anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

this also applies to the rest of the document.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 15, 2016

sorry for the delay, have been out on vacation for a while. a few comments:

  • use "Primitive Type" instead of "Predefined type"
  • do not think the syntax column is adding much value, it is not filled for most entries, i would just remove it.
  • In the first table, description and category are mislabeled. seems like he description column has the category and the category column has the description .

@zspitz
Copy link
Author

zspitz commented Sep 6, 2016

@mhegazy Fixed 'primitive type' to 'predefined type', and headings.
RE: syntax column -- When the same keyword has different meanings (like abstract which is applied to both classes and members), the syntax column clarifies the difference between them. This is particularly true when the meanings have little or no relation to each other (e.g. the distinction between this function parameters, and this-based type guards).
I had originally thought to have the syntax in the first column, but I think the order becomes confusing when the syntax doesn't start with the keyword (e.g. for an entry on the default keyword, if the syntax is in the first column -- export default expr -- there's no way to easily identify that the entry is here because of the default keyword).

@metaleap
Copy link

Status on this? =)

@zspitz
Copy link
Author

zspitz commented Mar 15, 2017

@mhegazy @metaleap There are some changes that need to be made here for 2.1 and 2.2. But if the release-2.0 branch is obsolete, and this PR needs to be merged somehow into the master branch, then I guess that should be done first.

@RyanCavanaugh
Copy link
Member

Thank you for contributing to the TypeScript Handbook!

We are currently working through a large backlog of open PRs. As part of this, we're asking authors of PRs with active merge conflicts to assess if their changes are still needed, and if so, open a new PR.

For transparency, we are also working on a full-scale reimagining of the Handbook (see the TypeScript Roadmap), meaning we are largely closing down work on the current version of the Handbook. Typo fixes are always appreciated, but any new content should likely wait until the new Handbook is available so that it can be more naturally adapted to that format.


Saved reply above; this technically doesn't have merge conflicts but has a ton of unrelated changes in one PR and I'm not comfortable merging it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants