‘Allāmah ‘Abdul ‘Azīz ibn Aḥmad al-Qurashī al-Farhārī (approx. 1794 – 1825 CE), from Multan (in present-day Pakistan), one of the great Sunnī scholars of that region and a prolific author (despite young age), wrote a widely-accepted marginalia on Sharḥ al-‘Aqā’id al-Nasafiyya, called al-Nibrās. A recent edition has been made available online – find here.
One of the gems from this marginalia is his comprehensive explanation of the meaning/definition of ghayb in Sharī‘ah:
A translation is as follows:
Realise that people have unrefined words on the topic of ghayb. The verification is that ghayb is that which is hidden from the senses, necessary knowledge and deductive knowledge. The Qur’ān has pronounced its negation from all besides Him, exalted is He. Thus, whoever claims that he knows it has disbelieved, and whoever assents to (the claim of) a claimant has disbelieved. As for that which is known through sense or necessity or evidence, it is not ghayb, nor has one disbelieved by claiming it, nor by assenting to it with certainty in that which is certain and with uncertainty in that which is conjectural, according to the verifiers.
With this verification, the difficulty in the issues which are assumed that they are from the ghayb but are not (in fact) from them as they are perceived by hearing, seeing, necessity or evidence, is dispelled. One of them is the reports of the prophets because they are acquired from revelation and from the creation of a necessary knowledge in them or from the exposure of the existents to their senses.
The second of them is the reports of a saint because it is acquired from a prophet or a pious dream or divine inspiration or from looking into the Preserved Tablet which is established from those who experience [mystical] unveiling, although some jurists deny it.
The third of them is the report of the one who calculates the solar and lunar eclipse because it is based on decisive mathematical evidences.
The fourth of them is the reports of an astrologer and geomancer because astrology and geomancy are two evidentiary sciences that were sent down on some of the prophets and were then lost and the people became confused over them, so whoever draws evidence using a prophetic principle, he will be correct in the report.
The fifth of them is the report of a soothsayer because it is from that which the jinn inform him from observation or hearing the angels who are aware of future existents by means of revelation.
Further, we say: Many of the ḥadīths and statements of the Salaf have pronounced kufr on the astrologer and soothsayer and whoever assents to them, and several verifiers have stated that anathematisation is limited to the one who claims knowledge of ghayb or believes the stars manage (the creation) independently or believes the jinn know the ghayb.
I say: And despite this, engaging in astrology and soothsaying and assenting to them is not from the practice of the righteous people, and there is no doubt that they entail damaging the beliefs of the weak amongst the Muslims as they suppose the one giving the information is knower of ghayb; on top it being difficult for the īmān of a soothsayer to be secure as he seeks assistance from the devils.
Preserve this verification as it is from the unique features of our writings.