Last active
August 9, 2020 23:18
-
-
Save jaycosaur/2b5de42f0d5e452739d199af0cfe8693 to your computer and use it in GitHub Desktop.
Strong or Weak [typescript] - Typescript to Python field guide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Celsius = number; | |
type Fahrenheit = number; | |
function convertToCelsius(value: Fahrenheit): Celsius { | |
return (value * 9) / 5 + 32; | |
} | |
function convertToFahrenheit(value: Celsius): Fahrenheit { | |
return ((value - 32) * 5) / 9; | |
} | |
const converted = convertToCelsius(0); // it works! | |
const fahrenheitValue: Fahrenheit = 32; | |
convertToFahrenheit(fahrenheitValue); // it works! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment