Skip to content

Commit

Permalink
Update api.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed May 29, 2022
1 parent be2ad29 commit e141ac5
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions packages/cspell-lib/api/api.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="node" />
import { Glob, CSpellSettingsWithSourceTrace, ReplaceMap, DictionaryInformation, DictionaryDefinitionPreferred, DictionaryDefinitionAugmented, DictionaryDefinitionCustom, TextOffset, TextDocumentOffset, PnPSettings as PnPSettings$1, ImportFileRef, CSpellUserSettings, LocaleId, CSpellSettings } from '@cspell/cspell-types';
import { Glob, CSpellSettingsWithSourceTrace, TextOffset, TextDocumentOffset, ImportFileRef, CSpellUserSettings, LocaleId, CSpellSettings } from '@cspell/cspell-types';
export * from '@cspell/cspell-types';
import { CompoundWordsMethod, SuggestionResult, SuggestionCollector, WeightMap } from 'cspell-trie-lib';
import { CompoundWordsMethod, SuggestionResult, SuggestionCollector } from 'cspell-trie-lib';
export { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
export * from 'cspell-io';
import { URI } from 'vscode-uri';
Expand Down Expand Up @@ -208,20 +208,6 @@ declare class SpellingDictionaryCollection implements SpellingDictionary {
private _isNoSuggestWord;
}

/**
* The keys of an object where the values cannot be undefined.
*/
declare type OptionalKeys<T> = Exclude<{
[P in keyof T]: T[P] extends Exclude<T[P], undefined> ? never : P;
}[keyof T], undefined>;
/**
* Allow undefined in optional fields
*/
declare type OptionalOrUndefined<T> = {
[P in keyof T]: P extends OptionalKeys<T> ? T[P] | undefined : T[P];
};

declare const SymbolCSpellSettingsInternal: unique symbol;
interface CSpellSettingsInternal extends Omit<CSpellSettingsWithSourceTrace, 'dictionaryDefinitions'> {
[SymbolCSpellSettingsInternal]: true;
dictionaryDefinitions?: DictionaryDefinitionInternal[];
Expand All @@ -231,15 +217,6 @@ interface CSpellSettingsInternalFinalized extends CSpellSettingsInternal {
ignoreRegExpList: RegExp[];
includeRegExpList: RegExp[];
}
declare type DictionaryDefinitionCustomUniqueFields = Omit<DictionaryDefinitionCustom, keyof DictionaryDefinitionPreferred>;
interface DictionaryDefinitionInternal extends Readonly<DictionaryDefinitionPreferred>, Readonly<Partial<DictionaryDefinitionCustomUniqueFields>>, Readonly<DictionaryDefinitionAugmented> {
/**
* Optional weight map used to improve suggestions.
*/
readonly weightMap?: WeightMap | undefined;
/** The path to the config file that contains this dictionary definition */
readonly __source?: string | undefined;
}

declare function refreshDictionaryCache(maxAge?: number): Promise<void>;

Expand Down Expand Up @@ -371,15 +348,11 @@ declare namespace text_d {
declare type LanguageId = string;
declare function getLanguagesForExt(ext: string): string[];

declare type DocumentUri = URI;
declare type DocumentUri = Uri.Uri;
interface Position {
line: number;
character: number;
}
/**
* Range offset tuple.
*/
declare type SimpleRange$1 = [start: number, end: number];
interface TextDocumentLine {
readonly text: string;
readonly offset: number;
Expand Down Expand Up @@ -425,7 +398,7 @@ interface CreateTextDocumentParams {
version?: number | undefined;
}
interface TextDocumentContentChangeEvent {
range?: SimpleRange$1;
range?: SimpleRange;
text: string;
}
declare function createTextDocument({ uri, content, languageId, locale, version, }: CreateTextDocumentParams): TextDocument;
Expand All @@ -439,7 +412,7 @@ declare type LoaderResult = URI | undefined;

declare type CSpellSettingsWST$1 = CSpellSettingsWithSourceTrace;
declare type CSpellSettingsI$1 = CSpellSettingsInternal;
declare type PnPSettings = OptionalOrUndefined<PnPSettings$1>;
declare type PnPSettings = OptionalOrUndefined<PnPSettingsStrict>;
declare const sectionCSpell = "cSpell";
declare const defaultFileName = "cspell.json";
declare const defaultConfigFilenames: readonly string[];
Expand Down Expand Up @@ -523,8 +496,8 @@ interface IncludeExcludeOptions {
ignoreRegExpList?: RegExp[];
includeRegExpList?: RegExp[];
}
interface ValidationResult extends TextOffset {
line: TextOffset;
interface ValidationResult extends TextOffsetRW {
line: TextOffsetRW;
isFlagged?: boolean;
isFound?: boolean;
}
Expand Down Expand Up @@ -605,7 +578,6 @@ declare class DocumentValidator {
private suggest;
private genSuggestions;
}
declare type Offset = number;
declare type SimpleRange = readonly [Offset, Offset];

interface SpellCheckFileOptions extends ValidateTextOptions {
Expand Down

0 comments on commit e141ac5

Please sign in to comment.