Microsoft/TypeScript

Public APIs not normalizing paths

オープン

#9,486 opened on 2016/07/02

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (13,395 件のフォーク)batch import
BugDomain: APIHelp Wanted

Repository metrics

Stars
 (108,860 個のスター)
PR merge metrics
 (PR metrics pending)

説明

As discussed in this issue, the parseJsonConfigFileContent public API can fail on Windows when passed non-normalized paths (that is, paths containing backslash delimiters).

It appears that this is not the only public API with which this occurs. The following two public API functions call getDirectoryPath with non-normalized paths:

The first of these has caused numerous issue with tsify:

Is there any guidance regarding how module authors are supposed to use public TypeScript APIs that accept paths? Are paths always expected to be normalized? If so, that puts a burden on module developers. Would it not be preferable for the parseJsonConfigFileContent, findConfigFile, resolveTripleslashReference functions to normalize any paths before calling functions - like getDirectoryPath - that expect/assume normalized paths?

コントリビューターガイド