Created
November 3, 2021 14:17
-
-
Save 41y08h/1439f1ef6418b928f9684098f1d688fc to your computer and use it in GitHub Desktop.
refer to generic arguments inside a function
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
export default function validate<T>(schema: T) { | |
const {errors} = Joi.object<T>(schema); // You can use T type here | |
} | |
const validate: <T>(schema: T) => void = () => { | |
const {errors} = Joi.object<T>(schema); // You can't use T type here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment