Niedzielski has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373850 )

Change subject: Chore: Refine typing conventions docs
......................................................................


Chore: Refine typing conventions docs

Mention the compiler strict settings, and explicitly mark the preferred
ones.

Change-Id: I28086f4fa09aa4ea5a630795b3ba46f80d92a3c5
---
M docs/development.md
1 file changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Niedzielski: Verified; Looks good to me, approved



diff --git a/docs/development.md b/docs/development.md
index be3f58c..c239748 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -56,9 +56,12 @@
 
 In TypeScript, data types may be explicitly specified or (often) inferred by 
the
 compiler. Marvin's coding convention is to favor inference except for module
-exports. Another way to phrase this is: write concisely except for APIs. The
-reasoning is that the brevity of inferred code is preferred but APIs are seams
-and their types should be both fixed and documented.
+exports. Another way to phrase this is: write concisely except for APIs.
+
+The reasoning is that the brevity of inferred code is preferred -as long as
+the compiler doesn't complain- but APIs are seams and their types should be
+both fixed and documented. We have set up the TypeScript compiler with the
+strict settings so no implicit `any` or `null`/`undefined` should slip in.
 
 The following examples are possible module implementations but the second or
 third are preferred:
@@ -71,7 +74,7 @@
     export default app
     ```
 
-2. Explicitly typed (declared syntax):
+2. **Preferred** - Explicitly typed (declared syntax):
     ```js
     const app: FunctionalComponent<any> = () =>
       <div class="App">Hello world</div>;
@@ -79,7 +82,7 @@
     export default app
     ```
 
-3. Explicitly typed (inline syntax):
+3. **Preferred** - Explicitly typed (inline syntax):
     ```js
     export default (_props: any): JSX.Element =>
       <div class="App">Hello world</div>;
@@ -93,14 +96,14 @@
 
 The following are possible internal implementations but the second is 
preferred:
 
-1. Explicitly typed:
+1. Explicitly typed lambda:
     ```js
     server.get("*", (_request: express.Request, response: express.Response) => 
{
       response.status(404).send("Not found");
     });
     ```
 
-2. Implicitly typed:
+2. **Preferred** - Implicitly typed lambda:
     ```js
     server.get("*", (_request, response) => {
       response.status(404).send("Not found");

-- 
To view, visit https://gerrit.wikimedia.org/r/373850
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I28086f4fa09aa4ea5a630795b3ba46f80d92a3c5
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to