Repository navigation
Node: path.format input properties are optional - #21003
5 commits merged into
Conversation
If `base` does not exist, `name` and `ext` will be used to compute it. http://devdocs.io/node/path#path_path_format_pathobject
|
types/node/index.d.ts to authors (@DefinitelyTyped/DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis Microsoft TypeScript (account can't be detected)). Could you review this PR? |
|
@OliverJAsh Please fix the failures indicated in the Travis CI log. |
|
Build failed due to timeout. |
|
|
||
| export interface FormatInputPathObject extends | ||
| Pick<ParsedPath, 'root' | 'dir' | 'ext' | 'name'>, | ||
| Partial<Pick<ParsedPath, 'base'>> {} |
There was a problem hiding this comment.
I think all properties should be optional here.
rootis ignored ifdiris provided
==> so why have root mandatory if it is ignored?
==> and why should we mandate to setdir === ""to getrootused?extandnameare ignored ifbaseexists
==> I see no reason for mandatoryextandnameas they get ignored
==> not every path has an extension so why force users to set ""?
Not sure if it is possible to define a type which represents these interdependency.
There was a problem hiding this comment.
Not sure if it is possible to define a type which represents these interdependency.
I guess you could express a union of all the permutations:
type Obj =
{ base: string; ext: string; name: string; }
| { ext: string; name: string; }
| { base: string; };However I think it's simpler just to make them all optional, like you said. After all, you can call format with an empty object and it will work (i.e. it won't throw, so it's type safe).
There was a problem hiding this comment.
@Flarna Updated to make all properties optional.
|
@OliverJAsh Please fix the failures indicated in the Travis CI log. |
|
@RyanCavanaugh It's just a build timeout. It happens on every build unfortunately, when linting the Node typings.
|
|
Ping @RyanCavanaugh @Flarna. Build failed due to timeout. Please can we merge? |
|
Sorry, can't help here as I have no write access. As far as I know @Andy-MS has changed something in the types publisher to reduce the test time (see microsoft/types-publisher#398) but I don't know if this is already productive. You could try by closing and reopening this PR or push something. |
|
Could do this without using |
|
@Andy-MS Updated |
|
Thanks! |
* master: (356 commits) vuex-i18n: Fixes from code review (DefinitelyTyped#21418) resourcejs: Increase TypeScript version to match mongoose leaflet.polylinemeasure: Add TypeScript version updated TS version to 2.3 for �abel-webpack-plugin. crlf -> lf Make hljs a proper UMD module Use only major.minor for `highlight.js`. atom: fix several incorrect definitions. Update index.d.ts Node: `path.format` input properties are optional (DefinitelyTyped#21003) New typings for fs-cson module (DefinitelyTyped#21375) New typings for bunyan-format module (DefinitelyTyped#21376) [chart.js] Add 'pie' to ChartType Update highlight.js version to latest (9.12.0) Fix type for highlight.js continuation argument Fixed errors after dts-gen New typings for module wtfnode fix getMeasure result fix: IGenericDimensionLayout change return Value of getDimension() from Dimension Object puppeteer: setCookie should be less strict ... # Conflicts: # types/three/test/css3d/css3d_sprites.ts # types/three/test/webgl/webgl_materials.ts
) * Node: `path.format` input properties are optional If `base` does not exist, `name` and `ext` will be used to compute it. http://devdocs.io/node/path#path_path_format_pathobject * Node: `FormatInputPathObject`: all properties are optional * Node: add myself as author * Avoid usage of `Partial`
If
basedoes not exist,nameandextwill be used to compute it.http://devdocs.io/node/path#path_path_format_pathobject
Please fill in this template.
npm run lint package-name(ortscif notslint.jsonis present).Select one of these and delete the others:
If changing an existing definition:
tslint.jsoncontaining{ "extends": "dtslint/dt.json" }.