Skip to content

Commit

Permalink
Rewind some typescript knowledge
Browse files Browse the repository at this point in the history
  • Loading branch information
zourdyzou committed Jun 23, 2022
1 parent 20ba993 commit 01622f4
Show file tree
Hide file tree
Showing 4,485 changed files with 73,710 additions and 226,870 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 7 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ module.exports = {
browser: true,
es2021: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],
parser: '@typescript-eslint/parser',
extends: ["plugin:react/recommended", "plugin:prettier/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [
'react',
'@typescript-eslint',
"react",
"@typescript-eslint",
],
rules: {
quotes: ["error", "double"],
},
};
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLinters/eslint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions examples/Types/examples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
type UserPermissionsRole = "admin" | "user" | "manager";

type PermissionsWithoutAdminRole = Exclude<UserPermissionsRole, "admin">;

interface DepartmentsForPermissionRole {
depName: string;
levelClearence: number;
}

const DepsForPermission: Record<
UserPermissionsRole,
DepartmentsForPermissionRole
> = {
admin: {
depName: "security engineer",
levelClearence: 10,
},
user: {
depName: "Sales Markerting",
levelClearence: 5,
},
manager: {
depName: "Marketing",
levelClearence: 10,
},
};

type TuplePermissions = [UserPermissionsRole, UserPermissionsRole];

type BasicUser<A = boolean, P = TuplePermissions> = {
name: string;
surname: string;
age: number;
isAdmin: A;
permissions?: P;
};

type BasicUserWithoutPermissions = Omit<BasicUser, "permissions">;

export {
DepsForPermission,
BasicUserWithoutPermissions,
PermissionsWithoutAdminRole,
};
1 change: 1 addition & 0 deletions node_modules/.bin/eslint-config-prettier

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/prettier

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 01622f4

Please sign in to comment.