@@ -44,7 +44,7 @@ Furthermore by providing Interface declarations describing your API contracts yo
44
44
- [ tsconfig.json] ( #tsconfigjson )
45
45
- [ tslint.json] ( #tslintjson )
46
46
- [ 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 )
48
48
- [ FAQ] ( #faq )
49
49
- [ Project Examples] ( #project-examples )
50
50
@@ -808,8 +808,7 @@ export const getTargetCurrencyRate = createSelector(
808
808
``` js
809
809
{
810
810
" compilerOptions" : {
811
- " baseUrl" : " src/" , // enables relative imports to root
812
- " outDir" : " out/" , // target for compiled files
811
+ " outDir" : " dist/" , // target for compiled files
813
812
" allowSyntheticDefaultImports" : true , // no errors on commonjs default import
814
813
" allowJs" : true , // include js files
815
814
" checkJs" : true , // typecheck js files
@@ -825,14 +824,15 @@ export const getTargetCurrencyRate = createSelector(
825
824
" es2016" ,
826
825
" es2017.object"
827
826
],
828
- " target" : " es5" ,
829
- " module" : " es2015 " ,
827
+ " target" : " es5" , // "es2015" for ES6+ engines
828
+ " module" : " commonjs " , // "es2015" for tree-shaking
830
829
" moduleResolution" : " node" ,
831
830
" noEmitOnError" : true ,
832
831
" noFallthroughCasesInSwitch" : true ,
833
832
" noImplicitAny" : true ,
834
833
" noImplicitReturns" : true ,
835
834
" noImplicitThis" : true ,
835
+ " noUnusedLocals" : true ,
836
836
" strictNullChecks" : true ,
837
837
" pretty" : true ,
838
838
" removeComments" : true ,
@@ -842,7 +842,8 @@ export const getTargetCurrencyRate = createSelector(
842
842
" src/**/*"
843
843
],
844
844
" exclude" : [
845
- " node_modules"
845
+ " node_modules" ,
846
+ " src/**/*.spec.*"
846
847
]
847
848
}
848
849
```
@@ -860,27 +861,36 @@ export const getTargetCurrencyRate = createSelector(
860
861
"comment-format" : [true , " check-space" ],
861
862
"import-blacklist" : [true , " rxjs" ],
862
863
"interface-over-type-literal" : false ,
864
+ "max-line-length" : [true , 120 ],
863
865
"member-access" : false ,
864
- "member-ordering" : [true , {"order" : " statics-first" }],
866
+ "member-ordering" : [true , {
867
+ "order" : " fields-first"
868
+ }],
865
869
"newline-before-return" : false ,
866
870
"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 " ],
869
873
"no-invalid-this" : [true , " check-function-in-method" ],
870
874
"no-null-keyword" : false ,
871
875
"no-require-imports" : false ,
872
876
"no-switch-case-fall-through" : true ,
873
877
"no-trailing-whitespace" : true ,
878
+ "no-this-assignment" : [true , {
879
+ "allow-destructuring" : true
880
+ }],
874
881
"no-unused-variable" : [true , " react" ],
875
882
"object-literal-sort-keys" : false ,
883
+ "object-literal-shorthand" : false ,
884
+ "one-variable-per-declaration" : [false ],
876
885
"only-arrow-functions" : [true , " allow-declarations" ],
877
886
"ordered-imports" : [false ],
878
887
"prefer-method-signature" : false ,
879
888
"prefer-template" : [true , " allow-single-concat" ],
889
+ "semicolon" : [true , " ignore-interfaces" ],
880
890
"quotemark" : [true , " single" , " jsx-double" ],
881
891
"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 " ]
884
894
}
885
895
}
886
896
```
@@ -902,7 +912,7 @@ export default Select;
902
912
export { default as Select } from ' ./select' ;
903
913
...
904
914
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) :
906
916
907
917
// containers/container.tsx
908
918
import { Select } from ' ../components' ;
@@ -911,17 +921,22 @@ import Select from '../components/select';
911
921
...
912
922
` ` `
913
923
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
916
928
` ` ` ts
917
- // using relative import resolution
929
+ // added missing autoFocus Prop on Input component in "[email protected] " npm package
918
930
declare module ' ../node_modules/antd/lib/input/Input' {
919
931
export interface InputProps {
920
932
autoFocus? : boolean ;
921
933
}
922
934
}
935
+ ` ` `
923
936
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
925
940
import { Operator } from ' rxjs/Operator' ;
926
941
import { Observable } from ' rxjs/Observable' ;
927
942
0 commit comments