Skip to content
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

TypeScript training notes #165

Open
3 of 5 tasks
justinbmeyer opened this issue Jun 20, 2019 · 5 comments
Open
3 of 5 tasks

TypeScript training notes #165

justinbmeyer opened this issue Jun 20, 2019 · 5 comments

Comments

@justinbmeyer
Copy link
Member

justinbmeyer commented Jun 20, 2019

  • Guide should be tested in windows. npm run solutions

  • on the homepage, this link does not work image

  • The following isn't indented correctly:

     function bonusMaker(multiplier: number, ...names: string[]) {
      let total = 0;
      for(var i = 0; i < names.length; i++) {
        total = total + names[i].length;
       
       return multiplier*total;
     }
    
  • We should include a verifying solution section, so people know what commands to run.

  • Overviews should hint at the exercise.

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Jun 20, 2019

Why TypeScript

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Jun 20, 2019

Types

  • The following example needs to be improved. It felt unnecessary:
let someValue: any = "this is a string";

let strLength: number = (<string>someValue).length;

let otherValue: any = "this is a string";

let otherLength: number = (otherValue as string).length;

I used the example from Angular/RxJS.

something like:

import notTypeScriptFunc from "lib";


notTypeScriptFunc(1,2,3) as number

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Jun 20, 2019

Functions

  • The bonus maker example is a bit odd. I'd like to come up with something a bit nicer. Desired:
    • includes a return value
function legacyMultiply(a: any, b:any): any {
	return a * b;
}


function bonusMaker(multiplier: number, ...names: string[]): number {
  let total = 0;
  for(var i = 0; i < names.length; i++) {
    total = total + names[i].length;
  }
  return legacyMultiply( multiplier, total);
}
  • The solution includes <script> tags. We need to update so we can @sourceref .ts files. (Justin)

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Jun 20, 2019

Classes

  • It would be nice to have an intermediate "JS-only" class between the constructor-function example and the typescript class example.

  • I got a lot of questions about super. It might be worth having a link to its mechanics in JS.

  • move(distanceInFeet: number = 0) { shows default values. Questions if this was typescript or not.

  • In Statics What does the second statics example class RaptorCage extends DinoCage { show? What should someone learn from it? P2

  • Readonly allows unlimited "internal" sets right? It shows a property being set. It says "not changed" but not changed externally? P2

  • Might want to change let fierce = dino.roar; fierce(); to use setTimeout(dino.roar). Also maybe not use name b/c window.name is ""

  • We should split the tests so things can be verified on their own.

 IS-a VS HAS-a
// instead of 
d = new Dino()

d.eat()


// do this 
eat({})

@justinbmeyer
Copy link
Member Author

justinbmeyer commented Jun 20, 2019

Interfaces

  • Interfaces in Functions - long example, hard to follow

  • Describing Objects - seems to explain something we've seen.

  • Describing Functions - seems to explain something we've seen.

  • Add describing function interfaces.

  • Exercise 1 doesn't show how to test it. I think the explanation could be a bit more clear. P0

justinbmeyer added a commit that referenced this issue Jul 19, 2019
justinbmeyer added a commit that referenced this issue Jul 19, 2019
justinbmeyer added a commit that referenced this issue Jul 20, 2019
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

No branches or pull requests

1 participant