A hiring filter can quietly invent a fact. Suppose the importer initializes every posting with an empty list of countries. Later, the search code treats an empty list as “worldwide”. An employer who wrote only “remote” suddenly appears to hire in every country.

The ambiguity comes from putting two meanings in the same array. In TypeScript, I would give each meaning its own case:

type HiringArea = | { kind: "unspecified" } | { kind: "worldwide" } | { kind: "listed"; countries: readonly [string, ...string[]] }; function matchesCountry(area: HiringArea, country: string): boolean { return area.kind === "worldwide" || (area.kind === "listed" && area.countries.includes(country)); } 

Here the codes are normalized before matching. The non-empty tuple keeps a listed area from quietly becoming an empty array. A posting that just says “remote” stays visible in an unfiltered search. A country-specific search can now make a narrower promise.

Three examples make good regression cases. “UK remote” matches GB. “Remote” alone leaves the hiring area unspecified. “US company hiring remotely in Canada” matches CA, because the employer’s headquarters belongs in a different field.

Country matching is only one step. “Canada, Ontario only” needs a separate regional constraint. “Four hours of overlap with London” describes a schedule. Keeping the original sentence beside the parsed fields gives the next person enough information to correct an overly broad match.

This example grew out of work on HeyRole’s remote job board. If you maintain a search filter, try adding a fixture where the source leaves your most important field blank. Then check exactly where that record appears.