Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function assertRequiredRemovalDateSet(
}
if (
feature.compat_features &&
Object.keys(feature.status.by_compat_key).length > 0
Object.keys(feature.status.by_compat_key ?? {}).length > 0
)
return;
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const snapshots: { [key: string]: SnapshotData } = Object.fromEntries(yamlEntrie
// TODO: validate the snapshot data.

// Helper to iterate an optional string-or-array-of-strings value.
function* identifiers(value) {
function* identifiers(value: undefined | string | string[]) {
if (value === undefined) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"remark-parse": "^11.0.0",
"remark-rehype": "^11.1.2",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript": "^6.0.2",
"typescript-eslint": "^8.58.0",
"unified": "^11.0.5",
"web-specs": "^3.82.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,15 @@ describe("features", function () {
"css.properties.line-clamp",
).supportedInDetails(cr.version("100"));
assert.equal(lineClamp.length, 1);
assert.equal(lineClamp[0]?.supported, true);
assert.equal(lineClamp[0]?.qualifications?.prefix, "-webkit-");
const release = lineClamp[0];
assert("supported" in release);
assert(release.supported === true);
assert(release.supported !== null);
if ("qualifications" in release) {
assert.equal(release.qualifications.prefix, "-webkit-");
} else {
assert(false);
}
});

it("returns mixed results for (un)prefixed features", function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class Feature {
let unknown = false;
for (const s of this.supportStatements(release.browser)) {
const supported = s.supportedInDetails(release);
if (supported.supported && !supported.qualifications) {
if (supported.supported && !("qualifications" in supported)) {
return true;
}

Expand Down
6 changes: 4 additions & 2 deletions packages/compute-baseline/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"rootDir": "./src",
"outDir": "./dist",
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noUncheckedIndexedAccess": true
"noUncheckedIndexedAccess": true,
"types": ["node", "mocha"],
"strict": false
},
"include": ["./src"]
}
8 changes: 4 additions & 4 deletions packages/web-features/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/web-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
},
"devDependencies": {
"@types/node": "^20.19.37",
"typescript": "^5.9.3"
"typescript": "^6.0.2"
}
}
3 changes: 2 additions & 1 deletion packages/web-features/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "ESNext",
"moduleResolution": "Bundler",
"typeRoots": ["./node_modules/@types"],
"declaration": true
"declaration": true,
"types": ["node"]
}
}
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"moduleResolution": "Bundler",
"esModuleInterop": true,
"resolveJsonModule": true,
"noEmit": true
"noEmit": true,
"lib": ["ES2023"],
"types": ["node", "mocha"],
"strict": false
},
"exclude": ["packages/", "gh-pages/"]
}
12 changes: 9 additions & 3 deletions type-guards.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import type { FeatureData, FeatureMovedData, FeatureSplitData } from "./types";

export function isOrdinaryFeatureData(x: unknown): x is FeatureData {
return typeof x === "object" && "kind" in x && x.kind === "feature";
return (
typeof x === "object" && x !== null && "kind" in x && x.kind === "feature"
);
}

export function isSplit(x: unknown): x is FeatureSplitData {
return typeof x === "object" && "kind" in x && x.kind === "split";
return (
typeof x === "object" && x !== null && "kind" in x && x.kind === "split"
);
}

export function isMoved(x: unknown): x is FeatureMovedData {
return typeof x === "object" && "kind" in x && x.kind === "moved";
return (
typeof x === "object" && x !== null && "kind" in x && x.kind === "moved"
);
}