Skip to content

Commit cafcae9

Browse files
authored
Update README.md
1 parent b1aeb0f commit cafcae9

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

README.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Furthermore by providing Interface declarations describing your API contracts yo
4444
- [tsconfig.json](#tsconfigjson)
4545
- [tslint.json](#tslintjson)
4646
- [Default and Named Module Exports](#default-and-named-module-exports)
47-
- [Vendor Types Augumentation](#vendor-types-augmentation)
47+
- [Fixing Vendor Type Issues](#fixing-vendor-type-issues)
4848
- [FAQ](#faq)
4949
- [Project Examples](#project-examples)
5050

@@ -808,8 +808,7 @@ export const getTargetCurrencyRate = createSelector(
808808
```js
809809
{
810810
"compilerOptions": {
811-
"baseUrl": "src/", // enables relative imports to root
812-
"outDir": "out/", // target for compiled files
811+
"outDir": "dist/", // target for compiled files
813812
"allowSyntheticDefaultImports": true, // no errors on commonjs default import
814813
"allowJs": true, // include js files
815814
"checkJs": true, // typecheck js files
@@ -825,14 +824,15 @@ export const getTargetCurrencyRate = createSelector(
825824
"es2016",
826825
"es2017.object"
827826
],
828-
"target": "es5",
829-
"module": "es2015",
827+
"target": "es5", // "es2015" for ES6+ engines
828+
"module": "commonjs", // "es2015" for tree-shaking
830829
"moduleResolution": "node",
831830
"noEmitOnError": true,
832831
"noFallthroughCasesInSwitch": true,
833832
"noImplicitAny": true,
834833
"noImplicitReturns": true,
835834
"noImplicitThis": true,
835+
"noUnusedLocals": true,
836836
"strictNullChecks": true,
837837
"pretty": true,
838838
"removeComments": true,
@@ -842,7 +842,8 @@ export const getTargetCurrencyRate = createSelector(
842842
"src/**/*"
843843
],
844844
"exclude": [
845-
"node_modules"
845+
"node_modules",
846+
"src/**/*.spec.*"
846847
]
847848
}
848849
```
@@ -860,27 +861,36 @@ export const getTargetCurrencyRate = createSelector(
860861
"comment-format": [true, "check-space"],
861862
"import-blacklist": [true, "rxjs"],
862863
"interface-over-type-literal": false,
864+
"max-line-length": [true, 120],
863865
"member-access": false,
864-
"member-ordering": [true, {"order": "statics-first"}],
866+
"member-ordering": [true, {
867+
"order": "fields-first"
868+
}],
865869
"newline-before-return": false,
866870
"no-any": false,
867-
"no-inferrable-types": [true],
868-
"no-import-side-effect": [true, {"ignore-module": "^rxjs/"}],
871+
"no-empty-interface": false,
872+
"no-inferrable-types": [true, "ignore-params", "ignore-properties"],
869873
"no-invalid-this": [true, "check-function-in-method"],
870874
"no-null-keyword": false,
871875
"no-require-imports": false,
872876
"no-switch-case-fall-through": true,
873877
"no-trailing-whitespace": true,
878+
"no-this-assignment": [true, {
879+
"allow-destructuring": true
880+
}],
874881
"no-unused-variable": [true, "react"],
875882
"object-literal-sort-keys": false,
883+
"object-literal-shorthand": false,
884+
"one-variable-per-declaration": [false],
876885
"only-arrow-functions": [true, "allow-declarations"],
877886
"ordered-imports": [false],
878887
"prefer-method-signature": false,
879888
"prefer-template": [true, "allow-single-concat"],
889+
"semicolon": [true, "ignore-interfaces"],
880890
"quotemark": [true, "single", "jsx-double"],
881891
"triple-equals": [true, "allow-null-check"],
882-
"typedef": [true,"parameter", "property-declaration", "member-variable-declaration"],
883-
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"]
892+
"typedef": [true,"parameter", "property-declaration"],
893+
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case", "allow-leading-underscore"]
884894
}
885895
}
886896
```
@@ -902,7 +912,7 @@ export default Select;
902912
export { default as Select } from './select';
903913
...
904914

905-
// 3. now you can import your components in both ways like this:
915+
// 3. now you can import your components in both ways named (internal) or default (public):
906916

907917
// containers/container.tsx
908918
import { Select } from '../components';
@@ -911,17 +921,22 @@ import Select from '../components/select';
911921
...
912922
```
913923
914-
### Vendor Types Augmentation
915-
> Augmenting missing autoFocus Prop on `Input` and `Button` components in `antd` npm package (https://ant.design/).
924+
### Fixing Vendor Type Issues
925+
> Strategies to fix various issues coming from broken vendor type declaration files (*.d.ts)
926+
927+
- Augumenting library internal type declarations - using relative import resolution
916928
```ts
917-
// using relative import resolution
929+
// added missing autoFocus Prop on Input component in "[email protected]" npm package
918930
declare module '../node_modules/antd/lib/input/Input' {
919931
export interface InputProps {
920932
autoFocus?: boolean;
921933
}
922934
}
935+
```
923936
924-
// using node module resolution
937+
- Augumenting library public type declarations - using node module import resolution
938+
```ts
939+
// fixed broken public type declaration in "[email protected]" npm package
925940
import { Operator } from 'rxjs/Operator';
926941
import { Observable } from 'rxjs/Observable';
927942

0 commit comments

Comments
 (0)