gts icon indicating copy to clipboard operation
gts copied to clipboard

Documentation is missing

Open ribrdb opened this issue 6 years ago • 3 comments

@alexeagle mentioned that the TS style guide has lots of documentation, but it doesn't seem like any of that is available here. The most common issue we run into is type coercion. Apparently this is what the docs for that should say: TypeScript code may use the String() and Boolean() (note: no new!) functions, string template literals, or !! to coerce types.

const bool = Boolean(false);
const str = String(aNumber);
const bool2 = !!str;
const str2 = `result: ${bool2}`;

Using string concatenation to cast to string is discouraged, as we check that operands to the plus operator are of matching types.

Code must use Number() to parse numeric values, and must check its return for NaN values explicitly, unless failing to parse is impossible from context

ribrdb avatar Jan 08 '20 17:01 ribrdb

It would be so helpful, if you could find the time to share the style guide documentation for TypeScript as applied in GTS here:

https://google.github.io/styleguide/

pct-mlinnemann avatar Jan 24 '20 14:01 pct-mlinnemann

As I am dealing with trying to figure out where our style differs from this one, I could use a written reference.

kberg avatar Nov 21 '20 16:11 kberg

I'd love to see the README cover or link to how to customize some of the style with little tweaks. I like Google style except for bracket spacing. I just want to tweak that little bit.

wmlutz avatar Jun 23 '23 13:06 wmlutz